Computer Science Canada Breaking up an Immage |
Author: | josh [ Thu Nov 11, 2004 8:55 am ] | ||
Post subject: | Breaking up an Immage | ||
I am making a bttleship game in Compsci and we have been told to make a winning, losing, and intrdocutuins screen for it. I am trying to make this introduction where these 2 pics of battlehsihips bounce around the screen and then colide and one of the pics breaks up into a bunch of pieces that shoot off everywhere. So far the code I have allows me to take the multiple pics from a picture posistionsed with left corner at 0,0 and make them fly off in different directions. But the part that makes a white box ontop of the picture where the piece comes from does not work and I can't figure out why. I also can't figure out how to start off each piece from flying from its oritginal positon in the pic, as u can see when u run it they all come from position 0,0. thanx
*Note: I did have help from my compsci teacher with this but neither of us can figure it out now. Here is the immage so u can run the program. [img] http://tinypic.com/l86kx [/img] |
Author: | Delos [ Thu Nov 11, 2004 10:42 am ] |
Post subject: | |
From glancing over your code you way want to try a few things: - use records instead of a bunch of arrays. Right now you have arrays flying around everywhere...leading to some confusion, what goes where, what does what...&c &c. - the whole white boxes thing...I'm not sure why but the boxes are not being drawn on the screen. Try changing the colour of the box drawn to red or something and track down where it is that it is that it is being drawn. - as for the (0, 0) problem, perhaps the reseting of x1 and y1 for each counted loop has something to do with it? |
Author: | josh [ Thu Nov 11, 2004 10:55 am ] |
Post subject: | |
I actually have no idea what records are, I am trying a few things with the X and Y like using xtrack(i) and ytrack(i) instead. |
Author: | Delos [ Thu Nov 11, 2004 6:53 pm ] | ||
Post subject: | |||
Dude! Records are to arrays what, umm...guitars are to drums! Sure one is good on its own, but together they totally rock. Read all about them here: Records by Dodge Quick example:
This shows how records can be used to put a whole bunch of characteristics common to some objects in a little container. |
Author: | Cervantes [ Thu Nov 11, 2004 6:58 pm ] |
Post subject: | |
I think this is the link you meant to post. |
Author: | josh [ Thu Nov 11, 2004 7:11 pm ] |
Post subject: | |
thanks for the link, I will see about converting that. I guess I can use a record to store every piece of info about the broken off piece.. |
Author: | Delos [ Thu Nov 11, 2004 8:33 pm ] |
Post subject: | |
Good call Cervantes...nooo, my records are off! Must...update...done. |