forums

TNT Basic Forums > Programming Q&A
While loop syntax error
< Last Thread     Next Thread >
Author
Thread        Post A Reply

06-08-2003 18:49

Posted by:
shivers

Click Here to Email shivers   Find more posts by shivers

I am getting a syntax error on the line "wend" anybody know why? I hate little things like that.

global int displayX=640
global int displayY=480

global int maxx=map width * map tile width - 300
global int maxy=map height * map tile height - 300

hide mouse
fade down
graphics mode hardware displayX,displayY
vbl sync off


set framerate 40

load map 0
load images 128

maxx=map width * map tile width - 640
maxy=map height * map tile height - 480


open canvas 1,displayX+map tile width,displayY+map tile height

open map viewport 1,0,0,0 to displayX,displayY

'draw the scrolled area
canvas 1

draw frame
fade up

int done=false
int charX=0
int charY=0
int mapX=0
int mapY=0
float speed=0
int rotate=0
int currentcar=2
int carimage

'0=motorcycle
'1=hellcar
'2=mazda
'3=raider
'4=saab
'5=stiles (geo)

float accel[6]
float brake[6]
float turn[6]
float maxspeed[6]

'motorcycle
accel[0] = 0.21
brake[0] = 0.2
turn[0] = 0.45
maxspeed[0] = 9

'hellcar
accel[1] = 0.17
brake[1] = 0.15
turn[1] = 0.35
maxspeed[1] = 15

'mazda
accel[2] = 0.19
brake[2] = 0.18
turn[2] = 0.30
maxspeed[2] = 15

'raider
accel[3] = 0.125
brake[3] = 0.115
turn[3] = 0.25
maxspeed[3] = 18

'saab
accel[4] = 0.20
brake[4] = 0.19
turn[4] = 0.35
maxspeed[4] = 15

'stiles
accel[5] = 0.18
brake[5] = 0.17
turn[5] = 0.45
maxspeed[5] = 11

if currentcar = 0 then carimage = 000
if currentcar = 1 then carimage = 001
if currentcar = 2 then carimage = 002
if currentcar = 3 then carimage = 003
if currentcar = 4 then carimage = 004
if currentcar = 5 then carimage = 005


sprite 1,charX+320,charY+240,001

'note, for angle to work perfectly, you've got to have the graphic
'rotated so the nice is facing RIGHT

int forwardgo
int backwardgo
int objNmb=map object count
int pX[objNmb],pY[objNmb],objExists[objNmb],n,tile,objType

for n=0 to objNmb-1
pX[n]=map Object X (n)*25
pY[n]=map Object Y (n)*25
objExists[n]=true
sprite n+2,0,0,0
next n

while not (pressed (12) )
canvas 1
' A code to do for each object
for n=0 to objNmb-1

' Get the object type
objtype=map object type (n)

' With this line, a sprite must have an image to be used;
' Later, you'll just need to use Sprite off so the object isn't usable anymore.
' -1 always represents NOTHING. ( 0 is always the first Index )
if sprite image (n+2)=-1 then objtype=-1

if objType=0
'hydrant
sprite n+2,Px[n]-mapX,Py[n]-mapY,009
end if
if objType=1
'streetsign
sprite n+2,Px[n]-mapX,Py[n]-mapY,006
end if
if objtype=2
'crate
sprite n+2,Px[n]-mapX,Py[n]-mapY,008
end if
if objtype=3
'trunk
sprite n+2,Px[n]-mapX,Py[n]-mapY,007
end if
if right
'charX=charX-15
rotate=rotate + turn[currentcar]*speed
if speed > 0 then speed = speed - 0.1
if speed < 0 then speed = speed + 0.1
end if
if left
'charX=charX+15
rotate=rotate - turn[currentcar]*speed
if speed > 0 then speed = speed - 0.1
if speed < 0 then speed = speed + 0.1
end if
if up
speed = speed + accel[currentcar]
'charY=charY-15
end if
if down
speed = speed - brake[currentcar]
'charY=charY+15
end if

if speed > 2 then speed = speed - 0.07
if speed < -2 then speed = speed + 0.07

if speed > maxspeed[currentcar] then speed = maxspeed[currentcar]
if speed < -1*maxspeed[currentcar] then speed = -1*maxspeed[currentcar]

charX = charX + cos(rotate+270)*speed
charY = charY + sin(rotate+270)*speed

if charX<0 then charX=0
if charY<0 then charY=0

if charX>maxx then charX=maxx
if charY>maxy then charY=maxy

mapX=charX
mapY=charY


sprite 1,charX+320,charY+240,carimage

set sprite rotation 1,rotate

set viewport offset 1,mapX,mapY
canvas 1
draw frame

'this is the troubled line!
wend
'this ^ one


fade down
end

06-08-2003 19:31

Posted by:
shivers

Click Here to Email shivers   Find more posts by shivers

i think i figured it out, sorry about that.

06-25-2003 00:04

Posted by:
Jason Anderson

Location:
Doylestown, PA

Click Here to Email Jason Anderson   Find more posts by Jason Anderson

I take it you realized you forgot a Next statement, correct? That's what I found.

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.