Computer Science Canada Icy Tower |
Author: | Mr. T [ Sun Jun 26, 2005 7:26 pm ] | ||
Post subject: | Icy Tower | ||
How can i make the blocks fall down in a continuous motion with a uniform interval in between each block.
|
Author: | Cervantes [ Sun Jun 26, 2005 7:36 pm ] |
Post subject: | |
One way to do it would be to assign the y values of the blocks random values between maxy and maxy * 2 or times whatever you wish. Another way to do it is only create a new block if the upper bounds of the blocks array is less than a certain value. Of course, this would spawn blocks in quick succession. You'd also have to put a time delay on it. This way will ensure that you get a block every so often, making it possible (given that you can jump the width of the tower). On the other hand, it's very regulated, perhaps too much so. This method will require flexible arrays. |
Author: | Mr. T [ Sun Jun 26, 2005 7:53 pm ] |
Post subject: | Alex's Opinion |
i dont understand, could u write up an examplke that applies to my code? |
Author: | Cervantes [ Sun Jun 26, 2005 8:20 pm ] | ||||
Post subject: | |||||
I suppose so. Method 2:
Method 3 (better)
The advantages of method 3 are that you don't have to worry about changing a hardcoded value for how many blocks you have on the screen, it'll do all the timings for you based on the number of blocks and the screen height. Second, you don't have to delete a block then add a block. In fact, you don't even need to use flexbile arrays for method 3. |
Author: | MysticVegeta [ Sun Jun 26, 2005 9:53 pm ] |
Post subject: | |
Ontopic: Well its just like having the asteroid code of jamonathin except the movement here is vertical... Calling it in a procedure would be efficient, because i am assuming that it is in a game. Offtopic: Wow cervantes, you finally made a program without flexible arrays |