forums

TNT Basic Forums > Programming Q&A
Car Game Help
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-06-2003 14:55

Posted by:
GameDev

Click Here to Email GameDev   Find more posts by GameDev

I am currently working on a overhead scrolling car game. I would like to know how I can program the map to scroll in the direction that the car is rotated to. Here is my code (not much, I just started yesterday)
----------------------------------------------
Hide Mouse
fade Down
graphics mode hardware 640,480
vbl sync on
set framerate 35
open canvas 1,1600,1600
open viewport 1,0,0 to 640,480
load map 128
load images 128
int carx=320
int cary=240
int crotate=0
Canvas 1
Draw Map Section 0,0 to 100,100,0 to 0,0
draw frame
fade up
int carsp=0
int xview=0,yview=0
while not mouse button
sprite 0,carx,cary,000
cary=cary+carsp
set sprite rotation 0,crotate
if up
carsp=carsp-1
end if
if down
yview=yview+2
cary=cary+2
end if
if Left
carx=carx-2
end if
if Right
carx=carx+2
end if
if space
carsp=carsp+6
end if
if (xview<0)
xview=0
else if (xview>1600-Viewport Width(1))
xview=1600-Viewport Width(1)
end if
if (yview<0)
yview=0
else if (yview>1600-Viewport Height(1))
yview=1600-Viewport Height(1)
yview=yview+carsp
end if
if carsp > 0
carsp=0
end if
Set Viewport Offset 1,xview,yview
cary=cary+carsp
draw frame
wend
Close Viewport 1
Fade Down
Text Mode
Fade Up
Show Mouse
---------------------------------------------
Thanks for your help

07-06-2003 20:31

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Hi,
Somebody's already done a similar project to what you are describing called MacSuperSprintMultiplayer (sorry can't remember who done it) and look under the downloads section for more information about scrolling.

Good luck,
Mark_667

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.