Computer Science Canada Bricks |
Author: | upthescale [ Wed Jun 07, 2006 4:06 pm ] |
Post subject: | Bricks |
Im making a paddle (Brick ) game, and i hav a problem. I am using an array for my bircks, but i want them not to go at random so i do this: [code for i : 1 .. 6 Draw.Box (Brick (i).Brickx - 30 + i * 61, Brick (i).Bricky + 20, Brick (i).Brickx + 30 + i * 60, Brick (i).Bricky, 2) end for [/code] when the ball hits them it bounces the right weay, my problem is when it hits it, i want only one of the block to disapear (Brick(i).Bricky:=1000, jsut to get otu of the screen) but the problem is that the whole row will go or even all 3 rows. thanks |
Author: | upthescale [ Wed Jun 07, 2006 4:17 pm ] |
Post subject: | |
Sorry i am using whatdtcolor, that is why they all move! |
Author: | Clayton [ Wed Jun 07, 2006 4:25 pm ] |
Post subject: | |
i am assuming that you are using records, so just have a flag for each block and when that block is hit change it to false, refresh the blocks with their flag set to true and voila ! |
Author: | upthescale [ Wed Jun 07, 2006 4:40 pm ] |
Post subject: | |
flag? wut u meen? |
Author: | Delos [ Wed Jun 07, 2006 4:47 pm ] | ||||
Post subject: | |||||
Add another field to your record to determine whether or not to draw the object. For instance:
The last field will allow you to determine whether or not to draw the object - and may also be incorporated in your collision detection. Alternately you could use:
By having the flag more than a binary variable, you can have various states - for instance, 0 == invisible, 1 == visible, 2 == visible and unbreakable, etc. Now, upthescale, I must ask. Is your keyboard broken? No, really, does it have missing letters or something else otherworldly? The extent to which your posts are obfuscated is quite irritating. Perhaps use the 'Preview' button a little more frequently eh? |
Author: | _justin_ [ Thu Jun 08, 2006 7:02 am ] | ||||||
Post subject: | |||||||
what you can do is have a boolean var
what the 1..3 does is says their will be 3 rows of bricks and then the 1..10 mean that their will be ten bricks across then i drew all the bricks in a for loop
and then i used this for my collision dection
what that does is checks to see if the ball hit a brick and what location is and turns "showing" to false and then draws a white brick over top of it h hope that helps |
Author: | Clayton [ Thu Jun 08, 2006 7:36 am ] |
Post subject: | |
_justin_ dont just give him the code ![]() ![]() |
Author: | _justin_ [ Thu Jun 08, 2006 10:27 am ] |
Post subject: | |
![]() hmm now i can't edit my post |