Computer Science Canada Deleting the brick when the ball hits its |
Author: | Velocity [ Wed Dec 14, 2011 7:09 pm ] |
Post subject: | Deleting the brick when the ball hits its |
What is it you are trying to achieve? When the ball bounces off the paddle and hits a brick, the brick gets deleted. What is the problem you are having? deleting the brick. Describe what you have tried to solve this problem I tried putting each brick value into a procedure with a cls and when the ball touches it i execute the procedure, i also tried saying if the x and y value equals the box shell value it will make the box move off the screen. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) I m sure that everyone is already aware of my code as you may have seen it in my previous posts, i just want to know how to make the brick go away after the ball hits it. Please specify what version of Turing you are using 4.1.1a |
Author: | Velocity [ Wed Dec 14, 2011 7:28 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
if ball_x1 = block_x1 then d1Clear if ball_x1 = block_x2 then d1Clear if ball_x1 = block_y1 then d1Clear if ball_x1 = block_y2 then d1Clear if ball_y1 = block_x1 then d1Clear if ball_y1 = block_x2 then d1Clear if ball_y1 = block_y1 then d1Clear if ball_y1 = block_y2 then d1Clear end if end if end if end if end if end if end if end if that is what i thought when d1Clear = drawfillbox .... block_x1, x2, y1, y2, it runs the program but it doesnt do anything. Here is my code to those who have not seen it : import GUI View.Set ("graphics:638;690") %_______The "Bank"_______% type DataOfBlock : record x, y, width, height, center : int defeated : boolean end record type DataOfShell : record right, top, left, bottom, c : int end record type BallData : record x, y, r, xv, yv, speed, c : int end record %_______Global Variables_______% var PicID : int var x : int := 700 var y : int := 500 var replay : string var fontS : int var xSpacing, ySpacing : int % var blockH, blockW : int % var shell : DataOfShell % var ball : BallData %%% var blockXDimension : int := 20 % var blockYDimension : int := 10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% var block : array 1 .. blockXDimension, 1 .. blockYDimension of DataOfBlock % var x1, y1, x2, y2 : int var ball_x1, ball_x2, ball_y1, ball_y2 : int % var ball_directionx1 : int := 1 % var ball_directiony1 : int := 1 var ball_directiony2 : int := 1 var ball_directionx2 : int := 1 % var ball_speed : int var continueGame : string % var lives : int % var score : int var timeElapsed1, timeElapsed2 : int var boundary_x1 : int := ((maxx div maxx) - 1) + 20 % var boundary_x2 : int := maxx - 20 % var boundary_y1 : int := maxy - 20 % var boundary_y2 : int := ((maxy div maxy) - 1) + 20 var block_x1, block_y1, block_x2, block_y2 : int proc initialValues % Blocks (overall) shell.right := 710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% shell.top := 680 % shell.left := 60 % shell.bottom := 50 % shell.c := 35 % Ball ball_speed := 10 % ball_x1 := 512 % ball_y1 := 200 % Paddle (Player) x1 := 250 % y1 := 25 % x2 := 350 % y2 := 50 % lives and score lives := 2 score := 0 % blocks block_x1 := 25 block_y1 := 200 block_x2 := 75 block_y2 := 250 % font fontS := Font.New ("Verdana:20") % splash screen timeElapsed1 := Time.Elapsed div 1000 Pic.Draw (PicID, maxx div 2 - (638 div 2), maxy div 2 - (690 div 2), picCopy) end initialValues procedure d1Clear drawfillbox (block_x1 + 40, block_y1 + 75, block_x2 + 40, block_y2 + 75, blue) cls end d1Clear %_______Procedures_______% procedure TheGame initialValues setscreen ("graphics:1000;650,title:The AI BrickBreaker Game") View.Set ("offscreenonly") var arrowKeys : array char of boolean lives += 1 timeElapsed1 := Time.Elapsed div 1000 loop locate (1, 10) put "Lives: ", lives locate (1, 30) put "Score: ", score locate (1, 50) timeElapsed2 := Time.Elapsed div 1000 - timeElapsed1 put "Game Time: ", timeElapsed2 %% Player Screen %%________________________________________________ drawfillbox (block_x1 + 40, block_y1 + 75, block_x2 + 40, block_y2 + 75, blue) drawfillbox (block_x1 + 100 + 20, block_y1 + 75, block_x2 + 100 + 20, block_y2 + 75, blue) drawfillbox (block_x1 + 180 + 20, block_y1 + 75, block_x2 + 180 + 20, block_y2 + 75, blue) drawfillbox (block_x1 + 260 + 20, block_y1 + 75, block_x2 + 260 + 20, block_y2 + 75, blue) drawfillbox (block_x1 + 340 + 20, block_y1 + 75, block_x2 + 340 + 20, block_y2 + 75, blue) drawfillbox (block_x1 + 40, block_y1 + 150, block_x2 + 40, block_y2 + 150, blue) drawfillbox (block_x1 + 80 + 20 + 20, block_y1 + 150, block_x2 + 80 + 20 + 20, block_y2 + 150, blue) drawfillbox (block_x1 + 160 + 20 + 20, block_y1 + 150, block_x2 + 160 + 20 + 20, block_y2 + 150, blue) drawfillbox (block_x1 + 240 + 20 + 20, block_y1 + 150, block_x2 + 240 + 20 + 20, block_y2 + 150, blue) drawfillbox (block_x1 + 320 + 20 + 20, block_y1 + 150, block_x2 + 320 + 20 + 20, block_y2 + 150, blue) drawfillbox (block_x1 + 40, block_y1 + 225, block_x2 + 40, block_y2 + 225, blue) drawfillbox (block_x1 + 80 + 20 + 20, block_y1 + 225, block_x2 + 80 + 20 + 20, block_y2 + 225, blue) drawfillbox (block_x1 + 160 + 20 + 20, block_y1 + 225, block_x2 + 160 + 20 + 20, block_y2 + 225, blue) drawfillbox (block_x1 + 240 + 20 + 20, block_y1 + 225, block_x2 + 240 + 20 + 20, block_y2 + 225, blue) drawfillbox (block_x1 + 320 + 20 + 20, block_y1 + 225, block_x2 + 320 + 20 + 20, block_y2 + 225, blue) drawfillbox (block_x1 + 40, block_y1 + 300, block_x2 + 40, block_y2 + 300, blue) drawfillbox (block_x1 + 120, block_y1 + 300, block_x2 + 120, block_y2 + 300, blue) drawfillbox (block_x1 + 200, block_y1 + 300, block_x2 + 200, block_y2 + 300, blue) drawfillbox (block_x1 + 280, block_y1 + 300, block_x2 + 280, block_y2 + 300, blue) drawfillbox (block_x1 + 360, block_y1 + 300, block_x2 + 360, block_y2 + 300, blue) %% AI Screen %%________________________________________________ drawfillbox (block_x1 + 540, block_y1 + 75, block_x2 + 540, block_y2 + 75, blue) drawfillbox (block_x1 + 620, block_y1 + 75, block_x2 + 620, block_y2 + 75, blue) drawfillbox (block_x1 + 700, block_y1 + 75, block_x2 + 700, block_y2 + 75, blue) drawfillbox (block_x1 + 780, block_y1 + 75, block_x2 + 780, block_y2 + 75, blue) drawfillbox (block_x1 + 860, block_y1 + 75, block_x2 + 860, block_y2 + 75, blue) drawfillbox (block_x1 + 540, block_y1 + 150, block_x2 + 540, block_y2 + 150, blue) drawfillbox (block_x1 + 620, block_y1 + 150, block_x2 + 620, block_y2 + 150, blue) drawfillbox (block_x1 + 700, block_y1 + 150, block_x2 + 700, block_y2 + 150, blue) drawfillbox (block_x1 + 780, block_y1 + 150, block_x2 + 780, block_y2 + 150, blue) drawfillbox (block_x1 + 860, block_y1 + 150, block_x2 + 860, block_y2 + 150, blue) drawfillbox (block_x1 + 540, block_y1 + 225, block_x2 + 540, block_y2 + 225, blue) drawfillbox (block_x1 + 620, block_y1 + 225, block_x2 + 620, block_y2 + 225, blue) drawfillbox (block_x1 + 700, block_y1 + 225, block_x2 + 700, block_y2 + 225, blue) drawfillbox (block_x1 + 780, block_y1 + 225, block_x2 + 780, block_y2 + 225, blue) drawfillbox (block_x1 + 860, block_y1 + 225, block_x2 + 860, block_y2 + 225, blue) drawfillbox (block_x1 + 540, block_y1 + 300, block_x2 + 540, block_y2 + 300, blue) drawfillbox (block_x1 + 620, block_y1 + 300, block_x2 + 620, block_y2 + 300, blue) drawfillbox (block_x1 + 700, block_y1 + 300, block_x2 + 700, block_y2 + 300, blue) drawfillbox (block_x1 + 780, block_y1 + 300, block_x2 + 780, block_y2 + 300, blue) drawfillbox (block_x1 + 860, block_y1 + 300, block_x2 + 860, block_y2 + 300, blue) %%_______________________________________________________________________________%% % for y : 1 .. blockYDimension % if y not= 1 then % if 470 + (y * (block (1, y - 1).height + ySpacing)) >= 650 then % exit % end if % end if % end for % for x : 1 .. blockXDimension % if x not= 1 then % if 60 + (x * (block (x - 1, y).width + xSpacing)) >= 610 then % exit % end if % end if % block (x, y).width := blockW % block (x, y).height := blockH % block (x, y).center := Rand.Int (2, 14) % block (x, y).x := 60 + (x * (block (x, y).width + xSpacing)) % block (x, y).y := 470 + (y * (block (x, y).height + ySpacing)) % block (x, y).defeated := false % if x not= 1 then % loop % if block (x, y).center = block (x - 1, y).center then % block (x, y).center := Rand.Int (4, 12) % else % exit % end if % end loop % end if % if y not= 1 then % loop % if block (x, y).center = block (x, y - 1).center then % block (x, y).center := Rand.Int (4, 12) % else % exit % end if % end loop % end if % end for % drawbox (shell.left, shell.bottom, shell.right, shell.top, shell.c) % drawbox (shell.left - 3, shell.bottom - 3, shell.right + 2, shell.top + 2, shell.c) % Draw.Fill (shell.left - 1, shell.bottom - 1, 35, 35) % for YP : 1 .. blockYDimension % for x : 1 .. blockXDimension % if block (x, y).defeated = false then % drawfillbox (block (x, y).x, block (x, y).y, block (x, y).x + % block (x, y).width, block (x, y).y + block (x, y).height, block (x, y).center) % end if % end for % end for % for YD : 1 .. blockYDimension % for x : 1 .. blockXDimension % if block (x, y).defeated = false then % if ball_x1 + ball_y1 >= block (x, y).x and ball_x1 - ball_y1 <= block (x, y).x + block (x, y).width then % if ball_y1 + ball_x1 >= block (x, y).y and ball_y1 - ball_x1 <= block (x, y).y + block (x, y).height then % block (x, y).defeated := true % score += 5 % ball.yv *= -1 % end if % end if % end if % end for % end for % if ball_y1 + ball_y1 >= shell.top then % ball_y1 := shell.top - ball_y1 - 1 + ball.yv % elsif ball_x1 - ball_y1 <= shell.left then % ball_x1 := shell.left + ball_y1 + 1 + ball.xv % elsif ball_x1 + ball_y1 >= shell.right then % ball_x1 := shell.right - ball_y1 - 1 + ball.xv % end if Input.KeyDown (arrowKeys) if arrowKeys (KEY_RIGHT_ARROW) then x1 += 10 x2 += 10 end if if arrowKeys (KEY_LEFT_ARROW) then x2 -= 10 x1 -= 10 end if if x1 > 250 and x2 < 350 then x1 := 100 elsif x1 < 250 and x2 > 350 then x2 := 100 elsif y1 > 25 and y2 < 50 then y1 := 25 elsif y1 < 25 and y2 > 50 then y2 := 25 end if if arrowKeys (KEY_ESC) then cls break end if var colorchanger1 : int randint (colorchanger1, 1, 101) delay (1) drawfillbox (x1, y1, x2, y2, colorchanger1) delay (5) drawbox (20, 20, maxx - 20, maxy - 20, 51) drawbox (5, 5, maxx - 5, maxy - 10, 51) drawfillbox (250, 900, 350, 925, 101) drawfillbox (maxx div 2 - 5 + 25, 20, maxx div 2 - 5 + 30, maxy - 20, 51) drawfilloval (ball_x1, ball_y1, 15, 15, 48) drawfill (maxx - 15, maxy - 15, 71, 51) if x1 >= maxx div 2 - 40 or x2 >= maxx div 2 + 15 then x1 -= 10 x2 -= 10 end if if x1 <= 25 or x2 <= +25 then x1 += 10 x2 += 10 end if if ball_y1 >= maxy - 40 then ball_directiony1 *= -1 end if if ball_x1 >= maxx div 2 + 5 then ball_directionx1 *= -1 end if if ball_x1 <= 45 then ball_directionx1 *= -1 end if var direction : int ball_x1 += (ball_directionx1 * ball_speed) ball_y1 += (ball_directiony1 * ball_speed) if ball_x1 <= x2 and ball_y1 <= y2 + 15 and ball_x1 >= x1 and ball_y1 >= y1 + 15 then ball_directiony1 *= -1 end if %% ______________ (AI + Paddle + ball)_______________%% var x1_1, y1_1, x2_2, y2_2 : int x1_1 := 1050 y1_1 := 25 x2_2 := 1150 y2_2 := 50 ball_x2 := 900 % ball_y2 := 200 drawfilloval (ball_x2, ball_y2, 15, 15, 61) drawfillbox (x1_1, y1_1, x2_2, y2_2, 141) if ball_y2 >= maxy - 40 then ball_directiony2 *= -1 end if if ball_x2 >= maxx div 2 + 5 then ball_directionx2 *= -1 end if if ball_x2 <= 45 then ball_directionx2 *= -1 end if var direction1 : int ball_x2 += (ball_directionx2 * ball_speed) ball_y2 += (ball_directiony2 * ball_speed) if ball_x2 <= x2_2 and ball_y2 <= y2_2 + 15 and ball_x2 >= x1_1 and ball_y2 >= y1_1 + 15 then ball_directiony2 *= -1 end if %%_________________________________________________%% if ball_y1 < 25 then lives -= 1 if lives <= 0 then cls Font.Draw ("You Have Lost ![]() put "You have acquired a total score of: ", score loop put "Would you like to play again?" get replay if replay = "Yes" or replay = "yes" or replay = "y" then put "Your game will replay shortly..." put "Get READY!" Time.Delay (3000) timeElapsed1 := 0 lives := 4 TheGame timeElapsed1 := Time.Elapsed div 1000 elsif replay = "No" or replay = "no" or replay = "n" then put "Good bye, and thanks for playing!" Time.Delay (2500) cls break else put "Invalid answer" cls end if end loop end if end if loop if ball_y1 <= 20 then cls put "Would you like to continue? y/n: " .. get continueGame else exit end if if continueGame = "y" or continueGame = "yes" then cls ball_x1 := 512 ball_y1 := 200 ball_directionx1 := 1 ball_directiony1 := 1 ball_directiony2 := 1 ball_directionx2 := 1 exit elsif continueGame = "n" or continueGame = "No" then put "Have A Nice Day!" delay (2500) break else put "Invalid answer." delay (2500) cls end if end loop delay (10) View.Update delay (5) cls end loop end TheGame procedure Instructions colorback (16) color (48) cls locate (4, 1) put "The objective of the game is..." locate (7, 1) color (58) put "to destroy all of the blocks on your side of the screen (bottom)" locate (10, 1) color (73) put "Before the computer destroys all of his blocks on his side of the screen (top)" locate (13, 1) color (81) put "You will use the 'Left' and 'Right' Arrow keys to move left and right" locate (16, 1) color (67) put "If you press the 'ESC' key on your keyboard the game will exit." locate (19, 1) color (96) put "Good Luck and go smash some blocks. HINT : You only have 3 Lives!" end Instructions procedure TheTitleScreen var font1 : int font1 := Font.New ("Arial:13") assert font1 > 0 PicID := Pic.FileNew ("ball02.jpg") Pic.Draw (PicID, maxx div 2 - (638 div 2), maxy div 2 - (690 div 2), picCopy) var game_Button : int := GUI.CreateButton (265, 275, 0, "Click To Play!", TheGame) var instruction : string locate (37, 4) Font.Draw ("Please hold 'Click to Play' while you type your answer below!", 50, 150, font1, yellow) locate (38, 4) Font.Draw ("You will be redirected to the instructions so keep holding your mouse.", 50, 125, font1, green) locate (39, 4) Font.Draw ("Or drag away from 'Click to Play' then read and Click it afterwards.", 50, 75, font1, yellow) locate (40, 4) Font.Draw ("Do you want to see the game Instructions? ", 50, 40, font1, green) locate (41, 47) get instruction if instruction = "yes" then Instructions else Instructions end if end TheTitleScreen procedure returnBack var go_back : char := "n" loop get go_back if go_back = "y" then TheTitleScreen end if end loop end returnBack TheTitleScreen loop exit when GUI.ProcessEvent end loop |
Author: | Dreadnought [ Wed Dec 14, 2011 8:54 pm ] |
Post subject: | Re: Deleting the brick when the ball hits its |
So your program runs loop Draw stuff View.Update Delay Cls end loop Your D1clear procedure draw a rectangle, then clear the screen. So what is the point of drawing the rectangle in the first place? When you want to "delete" the rectangle, what you want is for it to not show up anymore (and for the program to imagine its not there). Remember that your program draw all rectangles on every loop. So how would you go about making a rectangle not appear? And how does your program know that its should not appear? If you can answer these questions then you know what to do. |
Author: | Velocity [ Wed Dec 14, 2011 9:05 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
what i meant to say is if the ball_x1 and ball_y1 touches any side of the brick it will disappear. but it doesnt allow me say that because it has to be a boolean type, so i tried to scale it down but i failed. 1. i wanted to say when the ball touches the brick it clears it. 2. No clue 3. well when the ball touches the sides of the brick then it should not appear question 2 and 3 i have no clue how to go about doing that... could you explain those steps further please. |
Author: | mirhagk [ Wed Dec 14, 2011 9:18 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Well each brick should keep track of whether it's alive or dead, so you would want an array of booleans. You notice you are getting a lot of arrays, so you might want to just use a type, it will save you time in the future. So now you store whether it's alive or dead, you just need to check this each time you draw, so if it's dead, don't draw it. When the ball collides with the brick (I assume you know how to check for this) then just kill the brick. Also make sure the ball only collides with alive bricks. |
Author: | RandomLetters [ Wed Dec 14, 2011 9:24 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Say we have a box on the screen. In our game, we can have an integer, box1, which represents the state, or "should-be-drawn-ness" of the box. If it is 0, then the box has been cleared, so we dont draw it, if it is 1, then we need to draw it. Every frame, we check the value of that variable to determine if we need to draw it or not if box1 = 1 then %draw the box or, if you have multiple styles (for example, crumbling boxes, you could draw a different style with each number using a procedure) if box1 = 2 then %draw crumbling box thus, when you want to clear a box, all you need to do is set that variable to 0. if collision() then box1 = 0 end if In this way, you can have an array of integers representing each box. and loop through each integer to determine if you should draw a box or not. |
Author: | Velocity [ Wed Dec 14, 2011 10:47 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
if i knew how to make it so that if it is 0 the box will not be drawn then i wouldnt be askin- .... wait if i declare a variable for each co-ordinate of each box and say if the ball touches that co-ording then that co-ordinate equals 0 so it wont draw that co-ordinate? |
Author: | Velocity [ Wed Dec 14, 2011 10:51 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
and thank you for identifying the source of the problem for me ![]() |
Author: | Velocity [ Wed Dec 14, 2011 10:52 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
But could you further explain the meaning of what you referred to and to what i have asked? thanks ! |
Author: | RandomLetters [ Wed Dec 14, 2011 11:01 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Are you looking for how to detect collision between a ball and the brick? http://compsci.ca/v3/viewtopic.php?t=13661 For each brick, think of it as an "object" with information describing it. One is whether or not it exists on the screen. Another piece of information is the coordinates of each corner (like when you draw the box). These are separate pieces of information! You use those coordinates to detect collision as in the tutorial. |
Author: | Aange10 [ Thu Dec 15, 2011 1:33 am ] | ||
Post subject: | RE:Deleting the brick when the ball hits its | ||
Maybe this will help
|
Author: | Velocity [ Thu Dec 15, 2011 7:47 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Aange that actually helped sooo much! Thank you so much, i fixed my problem now, and random letters thank you so much for linking me to the tutorial for collision ![]() |
Author: | Aange10 [ Thu Dec 15, 2011 5:24 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Umhm. |
Author: | Velocity [ Mon Jan 09, 2012 1:08 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
um im sorry to be reviving dead threads but what if i didnt make all the brick seperatedly and i just made one set of a twenty bricks using for statements, then how would i go about clearing them? |
Author: | Aange10 [ Mon Jan 09, 2012 7:55 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
The trollish code posted above did use a set of bricks, 3. Now just change it from 3 to 20. |
Author: | Velocity [ Mon Jan 09, 2012 8:29 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
but i only used 1 variabloe... here this is what i did. proc Bricks (len, wid, col, xbound, ybound, spacex, spacey : int) var displacex : int := len + spacex var displacey : int := wid + spacey var bricksx : int := round (xbound / displacex) var bricksy : int := round (ybound / displacey) var ar_len : int := bricksx * bricksy - 1 var cur_x : int := 35 var cur_y : int := maxy + 40 for i : 0 .. ar_len drawfillbox (cur_x, cur_y - wid, cur_x + len, cur_y, col) cur_x := cur_x + displacex if cur_x + len > xbound then cur_x := 35 cur_y := cur_y - displacey end if delay (0) end for end Bricks thats the code i have for my bricks. |
Author: | Dreadnought [ Mon Jan 09, 2012 12:14 pm ] |
Post subject: | Re: Deleting the brick when the ball hits its |
Well why not just draw a white box over the brick. Then it is "erased". Alternately you can add to your procedure (if statements might be of use to you) to have it function in a way that resembles Aange10's example. |
Author: | Velocity [ Mon Jan 09, 2012 3:32 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
omg... im so fucking retarded now... i actually never thought of that... wow i think too far away from the actual problem, too deep into it, thank you so much dreadnought. you saved my life! |
Author: | Velocity [ Mon Jan 09, 2012 3:34 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
i implemented my brick collision and everything but since i half so many bricks made of one variable when i hit a brick they all disappear... how do i make the collision to delete the brick so that only one disappears (the one that i hit) ? |
Author: | Dreadnought [ Mon Jan 09, 2012 4:06 pm ] |
Post subject: | Re: Deleting the brick when the ball hits its |
Well, your procedure draws all the bricks at once. So either you draw them all at the beginning and erase them one at a time by drawing white boxes over them, or you modify your procedure to only draw the bricks that should be shown. It is useful (and, depending on your approach, essential) to use some data structure (like an array) to keep track of which bricks are "alive" and which ones are "dead", so you might need more than a single variable. |
Author: | Velocity [ Mon Jan 09, 2012 4:39 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
yea i see what your saying, but how do i tell the ball that it just hit the brick? im not asking to be rerouted to the popular brick to circular collision detection i just want a simple detour of how to do this. |
Author: | Aange10 [ Mon Jan 09, 2012 5:35 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Quote: i just want a simple detour of how to do this.
There are many. You've read the collision tutorial. It shows you how to do it. Whatdotcolor shows another way. The 60BILLION submissions of pong in the submissions forum have collision. The tons of people asking the exact same question in the last few months have your answer. If you want simple, then here it is: Check to see if any parts of the objects are touching. If that's not good enough, do some reading, instead of specifically asking us not to link you anything, and instead give you a 'simple detour'. |
Author: | Velocity [ Mon Jan 09, 2012 7:42 pm ] |
Post subject: | RE:Deleting the brick when the ball hits its |
well your fun... |
Author: | Aange10 [ Mon Jan 09, 2012 7:48 pm ] |
Post subject: | Re: RE:Deleting the brick when the ball hits its |
Velocity @ 9/1/2012, 6:42 pm wrote: well your fun...
Elaborate? |
Author: | Dreadnought [ Mon Jan 09, 2012 9:39 pm ] |
Post subject: | Re: Deleting the brick when the ball hits its |
You may not appreciate this question, but, could you show us what you have tried? |
Author: | Velocity [ Tue Jan 10, 2012 12:16 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
aange : I dont what it is but all of your text originated posts have made me laugh hard, to date. I dont mean to be rude, not at all, i just find it funny, and the strange part of have no friggin clue of why... Dreadnought : I completely appreciate your question, you reminded me of what i needed to do. I will most certainly add my code, just when i get to school tomorrow, cus right now im supposed to be sleeping but im on my phone, stuck to these forums ![]() *aside* darn it would be so awesome if i could program on my phone... Then i would never sleep xD |
Author: | Aange10 [ Tue Jan 10, 2012 7:59 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Quote: I dont what it is but all of your text originated posts have made me laugh hard, to date. I dont mean to be rude, not at all, i just find it funny, and the strange part of have no friggin clue of why... I'm not sure why all of the posts make you laugh, but whatever floats your boat. Albiet your confusing post, I'll be ready to see your code. However I'm surprised you didn't remember how to do collision: Velocity @ 10/1/2012, 12:05 am wrote: html is quite simple, i learned all the basics to make a simple website on my own and used w3schools to pick up the general skills, all round it took me about 30 mins to understand the main concept aside from my amazing memory... |
Author: | Velocity [ Tue Jan 10, 2012 8:33 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
no no, i know how to do collision, i just seem to be having a problem with the code because sometimes it hits and destroys the blocks and sometimes it doesnt.... Its strange. |
Author: | Aange10 [ Wed Jan 11, 2012 8:41 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
Quote: Its strange. You [hopefully] coded it. If you don't understand, look at one of the pong submissions. |
Author: | Velocity [ Wed Jan 11, 2012 8:43 am ] |
Post subject: | RE:Deleting the brick when the ball hits its |
yea i got it figured out. Thanks |