Computer Science Canada Trying to make the road move by looping. Car appears to accelerate. PLEASE HELP |
Author: | tttptiago [ Thu May 31, 2007 8:22 am ] |
Post subject: | Trying to make the road move by looping. Car appears to accelerate. PLEASE HELP |
Code works but i am trying to loop the road images under if key (KEY_UP_ARROW) then so that when the up arrow is pressed the car appears to be accelerating. THANKS |
Author: | crump3ts [ Thu May 31, 2007 4:15 pm ] |
Post subject: | Re: Trying to make the road move by looping. Car appears to accelerate. PLEASE HELP |
I would create seperate images (bitmaps) of the road. Each with the stripes in a differrent area. Then I would draw each one on the screen after the other, kind of like the old flip - book cartoon animation. Im using the same technique to draw explosions. Thats th basic idea Im using, its a thinker to figure out how to actually do it. |
Author: | DifinityRJ [ Fri Jun 01, 2007 2:20 pm ] |
Post subject: | Re: Trying to make the road move by looping. Car appears to accelerate. PLEASE HELP |
I haven't downloaded your game, but it appears that your not moving your car, your moving the background(road) so that the car appears to be moving. In this case, you need if up arrow key then if accelerate < 11 then accelerate+=1 end if else if accelerate > 0 then accelerate-=1 end if end if background (y) position -=accelerate Or something along that line. If i got this completely wrong then tell me, i don't have enough time to help you fully. Hope it helps. Edit: Oh, nevermind. Now i know what you mean. As stated before you could use different bitmap or jpg pictures. For example get like 2 bitmap images and draw the first one at 0,0 then the second one at 0,maxx and decrease both of their y value as your pressing the up arrow key, and when the first image is off the screen, then draw it above the second image, so there are no white spots, depending on your screen size, you might need more than 2 background pictures. |