(I almost put this in the bug report section but decided that programmer error is probably more likely!)
I'm making an Asteroids-esque game that's in its very early stages. My problem is that when I try to compile, I get:
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.8.044 SN:7fd51075 - 2D, WIN32
"solarsavior.gbas"(56) error : call to undefined function : CourageUpdate
It's referring to this piece of the code:
I don't understand, because it WAS compiling perfectly earlier today and I haven't even changed Area1 or CourageUpdate today...
Here's the full code:
Thanks for any help!!!
I'm making an Asteroids-esque game that's in its very early stages. My problem is that when I try to compile, I get:
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.8.044 SN:7fd51075 - 2D, WIN32
"solarsavior.gbas"(56) error : call to undefined function : CourageUpdate
It's referring to this piece of the code:
Code (glbasic) Select
FUNCTION Area1:
WHILE area1done=FALSE
CourageUpdate()
BulletUpdate()
DrawScreen()
WEND
ENDFUNCTION
I don't understand, because it WAS compiling perfectly earlier today and I haven't even changed Area1 or CourageUpdate today...
Here's the full code:
Code (glbasic) Select
// ------------------------------------------------------------- //
// --- SOLARSAVIOR ---
// ------------------------------------------------------------- //
SETCURRENTDIR ("Media")
SETSCREEN 640,480,0
LIMITFPS 12
LOADANIM "ship.bmp", 0,32,32
LOADANIM "bullet.bmp",1,1,2
LOADSOUND "shoot.wav",0,1
GLOBAL area1done=FALSE
CONSTANT thrustvel=.5
CONSTANT friction=1.05
TYPE bullet
x
y
angle
vecx
vecy
GLOBAL bullets[] AS bullet
//###
//Captain Courage Variables
//###
GLOBAL cx=320
GLOBAL cy=240
GLOBAL cangle=270
GLOBAL cvelx=0
GLOBAL cvely=0
GLOBAL cvecx=0
GLOBAL cvecy=0
GLOBAL canim=0
GLOBAL canimline=0
GLOBAL csound
// ------------------------------------------------------------- //
// --- AREA1 ---
// ------------------------------------------------------------- //
FUNCTION Area1:
WHILE area1done=FALSE
CourageUpdate()
BulletUpdate()
DrawScreen()
WEND
ENDFUNCTION
FUNCTION CourageUpdate:
//##
//Flying
//##
LOCAL thruston
IF cx<320 THEN csound=1
IF cx>320 THEN csound=-1
IF KEY(203) THEN INC cangle, 15
IF KEY(205) THEN DEC cangle, 15
IF KEY(200) THEN thruston=TRUE
IF cangle > 360 THEN DEC cangle, 360
IF cangle < 0 THEN INC cangle, 360
IF cx<0 THEN cx=0
IF cx>600 THEN cx=600
IF cy<0 THEN cy=1
IF cy>448 THEN cy=448
IF thruston=TRUE
INC canim,1
cvecx = -SIN(cangle)*thrustvel
cvecy = -COS(cangle)*thrustvel
cvelx = (cvelx+cvecx)
cvely = (cvely+cvecy)
ENDIF
cvelx = cvelx/friction
cvely = cvely/friction
IF cvecx>8 THEN cvecx=8
IF cvecy>8 THEN cvecy=8
IF cvecx<-8 THEN cvecx=-8
IF cvecy<-8 THEN cvecy=-8
IF canim>3 THEN canim=canim-2
cx=(cx+cvelx)
cy=(cy+cvely)
IF thruston=FALSE THEN canim=0
//########
//Shooting
//########
IF KEY(45) THEN CreateBullet()
ENDFUNCTION
FUNCTION CreateBullet:
LOCAL bullet AS bullet
PLAYSOUND (0,csound,1)
DIMPUSH bullets[],bullet
bullet.x=cx+16
bullet.y=cy
bullet.angle=cangle
bullet.vecx = -SIN(cangle)
bullet.vecy = -COS(cangle)
ENDFUNCTION
FUNCTION BulletUpdate:
bullet.x=bullet.x+bullet.vecx
bullet.y=bullet.y+bullet.vecy
ENDFUNCTION
FUNCTION DrawScreen:
ROTOZOOMANIM 0, 4*canimline+canim, cx, cy, cangle,1
FOREACH bullet IN bullets[]
DRAWANIM 1,RND(12),bullet.x,bullet.y
NEXT
SHOWSCREEN
ENDFUNCTION
Thanks for any help!!!