Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need some more breakout help...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ryft




PostPosted: Wed Jun 01, 2005 4:17 pm   Post subject: Need some more breakout help...

Alright since, my game is at school atm I'm going to explain my situtaion the best I can.

I'm making breakout for finalsummative evaluation. I've got pretty much everything down pat EXCEPT my problem with which bricks get deleted when the ball touches them. As of right now, when my ball touches one of the 30 bricks all get deleted. I tried using arrays but they didn;t help me much. From memory right now I just know that I used a for statement like this for my bricks:

code:

for i : 25 .. 350 by 75 %%% Draws row of 5 blocks
    for j : 285 .. 425 by 20 %%%Draws column of 6 blocks
        drawfillbox (0 + i, 0 + j, 50 + i, 10 + j, grey)
    end for
end for


Other then this, I used View.Update inside loop to make evrything else work. Thanks for any help.
Sponsor
Sponsor
Sponsor
sponsor
illu45




PostPosted: Wed Jun 01, 2005 5:25 pm   Post subject: (No subject)

hmm... I would suggest redrawing the brick in white...

For instance:

if ballx+ballradius = brickx+brickwidth and bally+ballradiu = bricky+bricklength then
drawfillbox (brickx, bricky, brickwidth, bricklength, white)
bricks(brickx,bricky) := 0

The last line is if you have an array (which would be good to have, IMO), it should delete the brick from that array, so that the ball can go through that space... The array should be a 5x6 array, housing 1's and 0's, 1 = brick, 0= blank... Or you could do it some other way... Up to you.
Ryft




PostPosted: Wed Jun 01, 2005 5:35 pm   Post subject: (No subject)

Hmmm. I'll try it your way and tell you my results...
Naveg




PostPosted: Wed Jun 01, 2005 6:45 pm   Post subject: (No subject)

there are many topics of this nature authored by mike200015, you can PM him for help if you want.
Ryft




PostPosted: Wed Jun 01, 2005 10:56 pm   Post subject: (No subject)

Alrigght, well that solved my problem, but another one was created Shocked . I noticed this after I started inserting blocks in different spots. As of now I have an array for the xBlock the y Block and if they are hit or not. So what it does is if the hit(i):= 0 then it draws xBlock(i) and yBlock(i) either grey (if they arent hit) or white(if they are hit). If the ball collides with a block it makes it disappear, and travel in the opposite direction to make it look like it bounced. However, because my for statement for the hit, xBlock and yBlock are all in the main loop, it sumtimes misses the direction switching because the for statement is looking up 1..2 over and over again... If neone understands this (cause I know it was very hard to explain) can anyone help?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: