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

Username:   Password: 
 RegisterRegister   
 Trying to make the road move by looping. Car appears to accelerate. PLEASE HELP
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tttptiago




PostPosted: 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



supermario.jpg
 Description:
 Filesize:  2.66 KB
 Viewed:  836 Time(s)

supermario.jpg



GAME-RACE.t
 Description:

Download
 Filename:  GAME-RACE.t
 Filesize:  10.46 KB
 Downloaded:  86 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
crump3ts




PostPosted: 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.
DifinityRJ




PostPosted: 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.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: