instead of:
LOAD BITMAP "gobface.bmp",2
GET IMAGE 2,0,0,128,128
DELETE BITMAP 2
just use:
load image "gobface.bmp", 2
As for your loops, they are the most messed up thing I've ever seen. I couldn't even indent the code properly because things are so out of place.
Here's what you got:
rem **********************
rem THE MAIN GAME LOOP
rem **********************
rem Begin loop
DO
rem UPDATE THE UI (there isn't much)
rem update the time taken
timeTaken=timeTaken+1
text 500,30,"Time Taken:"
text 585,30,(STR$(timeTaken))
rem update the number of penguins left
text 470,15,"Friends missing:"
text 585,15,(STR$(penguinsLeft))
rem ADJUST THE GOBLIN BASED ON THE PLAYER'S INPUT
rem turn the goblin based on left/right arrow keys
rem if the player is pressing the left key, then we turn 8 degrees left
rem for the right key, 8 degrees right
rem the "wrapvalue" takes numbers that are not between 0-360, and "wraps"
rem them around the circle to the correct value (like a clock hand going
rem from 11 to 1
stage=0
IF LEFTKEY()=1 THEN a#=a#-8.0
IF RIGHTKEY()=1 THEN a#=a#+8.0
a#=wrapvalue(a#)
rem Move the goblin forward and back position based on up/down keys
IF UPKEY()=1 THEN x#=NEWXVALUE(x#,a#,6) :
z#=NEWZVALUE(z#,a#,3) : stage=1
IF DOWNKEY()=1 THEN x#=NEWXVALUE(x#,a#,-6) :z#=NEWZVALUE(z#,a#,-3) : stage=1
rem Check to see if the player has hit the space key
rem the SPACE key is the command to make the goblin dig!
if spacekey()=1
rem digging is done by adjusting the height of grid points
rem on the "sand" matrix. So here, we need to convert the goblin's
rem X and Z coordinates to the matrix's grid coordinates
matrixX=(x#+mx#)/80
matrixZ=(z#+mz#)/80
rem cHeight is the height of the matrix point that the goblin is on.
rem we'll subtract 3 from that value to make the sand level go down
cHeight#=get matrix height(100,matrixX,matrixZ)
cHeight#=cHeight#-3
rem Check the height of the sand matrix versus the height of
rem the ground matrix. Only lower the level of the sand if it's higher
rem than the height of the ground it sits on.
if cHeight# > ((get matrix height(101,matrixX,matrixZ))-10)
set matrix height 100,matrixX,matrixZ,cHeight#
update matrix 100
endif
endif
rem check to see if the player has hit the SHIFT key
rem the SHIFT key tells the penguins to cry for help
rem we use the power of 3D positional sound to help the player identify
rem where the penguins are buried
if shiftkey()=1
rem the music is kind of lound, and I cant find a way to make the
rem music volume lower, OR make the penguins sound louder. So instead,
rem we just pause the music while they squack so that the player can hear
pause music 1
N=9
rem update the "position" of the listener in the 3d world
rem (we make it so that the goblin is the "listener", by setting the
rem position to be the same position as the goblin)
position listener x#,y#,z#
rem Now, each penguin that's still buried gets to cry for help
for X = 1 to numPenguins
N=N+1
rem this is where we check to see if the penguin is still around
rem or if it has been rescued already. If it has been rescued, we
rem don't want it to call for help anymore.
if object exist(N)=1
rem the "wait" commands are so that all the penguins don't call
rem at once, because you wouldn't be able to sort them out
wait 300
play sound N
wait 300
endif
next X
rem this turns the music back on. Gotta have the music!
loop music 1
endif
rem check to see if the player is trying to rescue one of the penguins
rem if the CONTROL key is being pressed:
rem do a collision check to see if the goblin is intersecting a penguin
if controlkey()=1
N=9
rem we want the penguin to shout with joy when it gets rescued, so we
rem need to update the position of the "listener" to match the goblin
position listener x#,y#,z#
rem go through all the penguins to see if any of them are close enough
rem to be rescued (the goblin has to be touching a penguin to rescue it)
for X = 1 to numPenguins
N=N+1
if object exist(N)=1
rem here's the collision detection. If the penguin and the goblin
rem are touching, then the penguin gets rescued
if object collision(N,1)=1
rem penguin shouts for joy. It's so happy!
play sound N
wait 300
play sound N
wait 300
play sound N
rem the player rescued a penguin! Record the rescue, and
rem make the penguin graphic go away, so that it doesn't confuse
rem the player
delete object N
rem update the number of penguins left so we can display it in the UI
penguinsLeft=penguinsLeft-1
rem check to see if that was the last penguin in the game (victory?)
if penguinsLeft=0
rem ************
rem VICTORY!
rem ************
rem the player has rescued all the penguins!
rem the player won the game, do the game winning stuff.
DO
rem a bunch of victory text. Hooray!
set text size 24
center text 320,180,"You win!"
set text size 14
center text 320,220,"Great job, you rescued all your Penguin friends from the sand!"
text 250,240,"Time taken:":text 340,240,(STR$(timeTaken))
center text 320,260,"Press F12 to exit."
loop
endif
endif
endif
next X
endif
rem Do Goblin position updating and checking
rem this next bit makes sure the goblin is standing on the ground.
rem it checks the X and Z coordinates for both the "Sand" and the "Ground"
rem and sets the goblin's feet on the one that is higher at that pointy#=get ground height(100,x#+mx#,z#+mz#) if (get ground height(101,x#+mx#,z#+mz#)) > y# then y#=get ground height(101,x#+mx#,z#+mz#)
rem Make sure the goblin stays in the map bounds (we don't want Antonio
rem falling off the edge of the world)
if x# > 900 then x#=900
if x# < -900 then x#=-900
if z# > 900 then z#=900
if z# < -900 then z#=-900
rem CAMERA CONTROLS
rem update the camera coordinates to move with AND point at Antonio
camX#=x#
camY#=y#+200
camZ#=z#-300
position camera camX#, camY#, camZ#
point camera x#,y#,z#
rem ANIMATION HANDLING - don't mess with this unless you know what you're doing
rem If character action changes
IF stage<>oldstage
IF stage=0
SET OBJECT FRAME 1,0.0
LOOP OBJECT 1,0,20
SET OBJECT SPEED 1,10
ENDIF
IF stage=1
SET OBJECT FRAME 1,105.0
LOOP OBJECT 1,105,125
SET OBJECT SPEED 1,40
ENDIF
oldstage=stage
ENDIF
rem UPDATE ANTONIO'S POSITION AND ANGLE ON THE MAP
POSITION OBJECT 1,x#,y#,z#
YROTATE OBJECT 1,a#
rem Refresh the screen
SYNC
rem End loop, start back up at the "DO"
LOOP
It should look like(im guessing):
rem **********************
rem THE MAIN GAME LOOP
rem **********************
rem Begin loop
DO
rem UPDATE THE UI (there isn't much)
rem update the time taken
timeTaken=timeTaken+1
text 500,30,"Time Taken:"
text 585,30,(STR$(timeTaken))
rem update the number of penguins left
text 470,15,"Friends missing:"
text 585,15,(STR$(penguinsLeft))
rem ADJUST THE GOBLIN BASED ON THE PLAYER'S INPUT
rem turn the goblin based on left/right arrow keys
rem if the player is pressing the left key, then we turn 8 degrees left
rem for the right key, 8 degrees right
rem the "wrapvalue" takes numbers that are not between 0-360, and "wraps"
rem them around the circle to the correct value (like a clock hand going
rem from 11 to 1
stage=0
IF LEFTKEY()=1 THEN a#=a#-8.0
IF RIGHTKEY()=1 THEN a#=a#+8.0
a#=wrapvalue(a#)
rem Move the goblin forward and back position based on up/down keys
IF UPKEY()=1 THEN x#=NEWXVALUE(x#,a#,6) :
z#=NEWZVALUE(z#,a#,3) : stage=1
IF DOWNKEY()=1 THEN x#=NEWXVALUE(x#,a#,-6) :z#=NEWZVALUE(z#,a#,-3) : stage=1
rem Check to see if the player has hit the space key
rem the SPACE key is the command to make the goblin dig!
if spacekey()=1
rem digging is done by adjusting the height of grid points
rem on the "sand" matrix. So here, we need to convert the goblin's
rem X and Z coordinates to the matrix's grid coordinates
matrixX=(x#+mx#)/80
matrixZ=(z#+mz#)/80
rem cHeight is the height of the matrix point that the goblin is on.
rem we'll subtract 3 from that value to make the sand level go down
cHeight#=get matrix height(100,matrixX,matrixZ)
cHeight#=cHeight#-3
rem Check the height of the sand matrix versus the height of
rem the ground matrix. Only lower the level of the sand if it's higher
rem than the height of the ground it sits on.
if cHeight# > ((get matrix height(101,matrixX,matrixZ))-10)
set matrix height 100,matrixX,matrixZ,cHeight#
update matrix 100
endif
endif
rem check to see if the player has hit the SHIFT key
rem the SHIFT key tells the penguins to cry for help
rem we use the power of 3D positional sound to help the player identify
rem where the penguins are buried
if shiftkey()=1
rem the music is kind of lound, and I cant find a way to make the
rem music volume lower, OR make the penguins sound louder. So instead,
rem we just pause the music while they squack so that the player can hear
pause music 1
N=9
rem update the "position" of the listener in the 3d world
rem (we make it so that the goblin is the "listener", by setting the
rem position to be the same position as the goblin)
position listener x#,y#,z#
rem Now, each penguin that's still buried gets to cry for help
for X = 1 to numPenguins
N=N+1
rem this is where we check to see if the penguin is still around
rem or if it has been rescued already. If it has been rescued, we
rem don't want it to call for help anymore.
if object exist(N)=1
rem the "wait" commands are so that all the penguins don't call
rem at once, because you wouldn't be able to sort them out
wait 300
play sound N
wait 300
endif
next X
rem this turns the music back on. Gotta have the music!
loop music 1
endif
rem check to see if the player is trying to rescue one of the penguins
rem if the CONTROL key is being pressed:
rem do a collision check to see if the goblin is intersecting a penguin
if controlkey()=1
N=9
rem we want the penguin to shout with joy when it gets rescued, so we
rem need to update the position of the "listener" to match the goblin
position listener x#,y#,z#
rem go through all the penguins to see if any of them are close enough
rem to be rescued (the goblin has to be touching a penguin to rescue it)
for X = 1 to numPenguins
N=N+1
if object exist(N)=1
rem here's the collision detection. If the penguin and the goblin
rem are touching, then the penguin gets rescued
if object collision(N,1)=1
rem penguin shouts for joy. It's so happy!
play sound N
wait 300
play sound N
wait 300
play sound N
rem the player rescued a penguin! Record the rescue, and
rem make the penguin graphic go away, so that it doesn't confuse
rem the player
delete object N
rem update the number of penguins left so we can display it in the UI
penguinsLeft=penguinsLeft-1
rem check to see if that was the last penguin in the game (victory?)
if penguinsLeft=0
rem ************
rem VICTORY!
rem ************
rem the player has rescued all the penguins!
rem the player won the game, do the game winning stuff.
DO
rem a bunch of victory text. Hooray!
set text size 24
center text 320,180,"You win!"
set text size 14
center text 320,220,"Great job, you rescued all your Penguin friends from the sand!"
text 250,240,"Time taken:":text 340,240,(STR$(timeTaken))
center text 320,260,"Press F12 to exit."
loop
endif
next X
endif
rem Do Goblin position updating and checking
rem this next bit makes sure the goblin is standing on the ground.
rem it checks the X and Z coordinates for both the "Sand" and the "Ground"
rem and sets the goblin's feet on the one that is higher at that pointy#=get ground height(100,x#+mx#,z#+mz#) if (get ground height(101,x#+mx#,z#+mz#)) > y# then y#=get ground height(101,x#+mx#,z#+mz#)
rem Make sure the goblin stays in the map bounds (we don't want Antonio
rem falling off the edge of the world)
if x# > 900 then x#=900
if x# < -900 then x#=-900
if z# > 900 then z#=900
if z# < -900 then z#=-900
rem CAMERA CONTROLS
rem update the camera coordinates to move with AND point at Antonio
camX#=x#
camY#=y#+200
camZ#=z#-300
position camera camX#, camY#, camZ#
point camera x#,y#,z#
rem ANIMATION HANDLING - don't mess with this unless you know what you're doing
rem If character action changes
IF stage<>oldstage
IF stage=0
SET OBJECT FRAME 1,0.0
LOOP OBJECT 1,0,20
SET OBJECT SPEED 1,10
ENDIF
IF stage=1
SET OBJECT FRAME 1,105.0
LOOP OBJECT 1,105,125
SET OBJECT SPEED 1,40
ENDIF
oldstage=stage
ENDIF
rem UPDATE ANTONIO'S POSITION AND ANGLE ON THE MAP
POSITION OBJECT 1,x#,y#,z#
YROTATE OBJECT 1,a#
rem Refresh the screen
SYNC
rem End loop, start back up at the "DO"
LOOP
I deleted like 2 or 3 "endif" statements because they didn't corespond to anything.
"eureka" - Archimedes