Computer Science Canada Moving Levels. |
Author: | magicman [ Thu May 20, 2004 9:06 am ] |
Post subject: | Moving Levels. |
I'm making a level for my game. It's a long level. When the player reaches the end of the screen, i want it to move with the player. What is the code to do that???¿¿¿ thanks for the help. |
Author: | Tony [ Thu May 20, 2004 12:39 pm ] |
Post subject: | |
you keep the player in the center of the screen and draw the level relative to the player. |
Author: | magicman [ Thu May 20, 2004 2:53 pm ] |
Post subject: | |
How would you make the player jump???¿¿¿ |
Author: | SuperGenius [ Thu May 20, 2004 2:58 pm ] |
Post subject: | |
have it check for the up button(or whichever button) being pressed, and then have the y coord of the sprite/picture increase and then decrease |
Author: | magicman [ Mon May 31, 2004 6:59 am ] |
Post subject: | |
What kind of coding would i have to do for the y coord to increase and decrease?? |
Author: | SuperGenius [ Mon May 31, 2004 2:52 pm ] | ||
Post subject: | |||
Here's a diagram. Dont let it confuse you because it has nothing to do with the x coord. It is a rough parabola. It would be a little tough to do because for every unit of time the change in position is a different amount. I'll give you an example. (keyword example)
time elapsed is the time that has passed since the jump started (when the key was pressed. You will also need to add a constant to the y value (unless your man normally walks at coord (x,0). The constant you need to add is the height of the ground that you used in your game (ex if he is running on a flat surface, that is the number that I am talking about) |
Author: | Cervantes [ Mon May 31, 2004 3:07 pm ] | ||
Post subject: | |||
erg, personally I wouldn't use Time.Elapsed. IMO, here's a simpler way of doing it.
hope this helps |
Author: | SuperGenius [ Mon May 31, 2004 4:06 pm ] |
Post subject: | |
i just meant that as an example, but i dunno the time module and stuff, so i just wrote that. |
Author: | rhomer [ Mon May 31, 2004 6:05 pm ] | ||
Post subject: | |||
My idea for you is to base all object as a distance away from the start of the ball... I just started working off Cervantes code... Its crappy cuz i did it very fast but it illustrates my point i think..
|
Author: | guruguru [ Mon May 31, 2004 6:19 pm ] | ||
Post subject: | |||
This topic had the similary problem of moving the background relative to the player. Click! As for jumping, a little procedure like this can be called whenever up is pressed. Just a slight modification of rhomers code.
|
Author: | s_climax [ Wed Jun 02, 2004 9:04 pm ] | ||
Post subject: | |||
This is a function I made for this program. Draw some boxes and jump around. It should tell you whether you're character has hit anything not white |
Author: | magicman [ Fri Jun 04, 2004 12:58 pm ] |
Post subject: | |
hey. I also need an easy way to make the screen move when my guy goes to the end of the run window. |