Indent your code properly and you should find nesting errors very easily.
What is this suppose to do? Is the code missing something?
if P1Y# = P1Y# + Gravity# :
endif
And what is this?
That's an invalid statement and you've done it multiple times. Oh I just noticed Rudolpho pointed this one out.
This code will now compile, assuming the corrections I made are what you originally intended. I had to change your variable
Step s Hit to
StepHit because the forum was flagging it as a bad word.
rem Steps
for t = 0 to 5
make object box t+7,50,10,50
position object t+7,0,5+(t*20),100+(t*100)
color object t+7,rgb(100,200,100)
make object collision box t+7,-25,-5,-25,25,5,25,0
next t
rem platforms--------------------------------------------------------------------------------------------------------------------------------
for p = 0 to 7
make object box p+102,50,10,50
position object p+102,100,10+(p*20),-100+(p*100)
color object p+102,rgb(0,0,100)
make object collision box p+102,-25,-5,-25,25,5,25,0
set object collision on p+102
next p
for a = 0 to 5
make object box a+80,50,10,50
position object a+80,200,5+(a*20),100+(a*100)
color object a+80,rgb(100,0,0)
make object collision box a+80,-25,-5,-25,25,5,25,0
next a
rem Fruits
NumberOfFruits = 20
FruitColor = 0
for t = 1 to NumberOfFruits
make object sphere t + NumberOfFruits ,50
texture object t + NumberOfFruits ,120
position object t + NumberOfFruits ,Rnd(1900)-950,30,Rnd(1900)-950
make object collision box t + NumberOfFruits ,-25,-25,-25,25,25,25,0
next t
rem Super Fruit
make object sphere 100,100
texture object 100,100
position object 100 ,0,180,725
make object collision box 100,-50,-50,-50,50,50,50,0
REM LOAD MODELS
REM SET COLLISIONS
REM SET CAMERA
REM SOUND EFFECTS
play sound 3
REM SPECIAL EFFECTS
REM REFRESH SCREEN
sync
REM *** MAIN SECTION LOOP
do
if scancode()=0 then exit
loop
do
REM SPECIAL EFFECTS
REM OBJECT ORIENTATIONS
P1X# = object position X(1)
P1Y# = object position Y(1)
P1Z# = object position Z(1)
A1X = object angle X(1)
A1Y = object angle Y(1)
A1Z = object angle Z(1)
REM CAMERA ORIENTATIONS
cpX# = camera position X()
cpY# = camera position Y()
cpZ# = camera position Z()
caX# = camera angle X()
caY# = camera angle Y()
caZ# = camera angle Z()
REM LIVE SCREEN DISPLAY
ink rgb(255,255,255),0 : set text size 16 : set text to bold : set text transparent
center text 320,420,"USE ARROW KEYS TO MOVE | PRESS SPACE BAR TO JUMP"
center text 320,440,"PRESS 'Q' TO QUIT"
set cursor 0,0
print "Seconds Left: ";(MyTimer/60)+1
Rem at 60 frames a second, every timer countdown is 1/60th of a second,
Rem so this will display the time left as whole seconds
set cursor 0,20
print "SCORE: ";MyScore
REM CONTROL INPUT
if Spacekey()=1 and MyAcceleration# = 0.0
P1Y# = P1Y# - Gravity#
position object 1, P1X#,P1Y#,P1Z#
for t = 6 to 12 : ` FIXED
if object collision(1,t+7) > 0
MyAcceleration# = MyPower
play sound 6
endif
next t
endif : ` MISSING
if Spacekey()=1 and MyAcceleration# = 0.0
P1Y# = P1Y# - Gravity#
position object 1, P1X#,P1Y#,P1Z#
for t = 6 to 12 : ` FIXED
if object collision(1,p+102)>0
MyAcceleration# = MyPower
play sound 6
endif
next t
endif
if Spacekey()=1 and MyAcceleration# = 0.0
P1Y# = P1Y# - Gravity#
position object 1, P1X#,P1Y#,P1Z#
for a = 6 to 12 : ` FIXED
if object collision(1,a+80) > 0
MyAcceleration# = MyPower
play sound 6
endif
next t
endif
`--------------------------------------------------------------------------------------------------------------------------------------------------
` NOT NEEDED
if P1Y# = P1Y# + Gravity# :
endif
if Upkey()=1 then move object 1,MySpeed
if Downkey()=1 then move object 1,0-MySpeed
if Leftkey()=1 then A1Y = wrapvalue(A1Y-(MySpeed/3))
if Rightkey()=1 then A1Y = wrapvalue(A1Y+(MySpeed/3))
if Inkey$()="q"
for x = 1 to 100
if object exist(x) = 1 then delete object x
next x
backdrop off
gosub EndSection
endif
REM TRANSFORM OBJECTS
REM MOVE OBJECTS
Yrotate object 1,A1Y
REM CHECK FOR COLLISION
rem Now that I've moved, record the new position
P1Xcol# = object position X(1)
P1Zcol# = object position Z(1)
Rem Arena Collision - Keep the player inside the walls
if P1Xcol#<-975 then P1Xcol#=-975
if P1Zcol#<-975 then P1Zcol#=-975
if P1Xcol#>975 then P1Xcol#=975
if P1Zcol#>975 then P1Zcol#=975
Rem Steps Collision
StepHit = 0
for CheckStep = 7 to 12
if object collision(1,CheckStep)>0
StepHit = StepHit + 1
endif
next t
Rem Reset Collision Positions
if StepHit > 0
position object 1, P1X#,P1Y#,P1Z#
else
position object 1, P1Xcol#,P1Y#,P1Zcol#
P1X# = P1Xcol# : P1Z# = P1Zcol#
endif
A1Y# = object angle Y(1)
Rem Gravity Effects
if MyAcceleration# = 0.0
EmptySpace = 0 : ObjectsChecked = 0
for CheckObject = 6 to 12
if object collision(1,CheckObject) > 0
P1Y# = P1Y# - Gravity#
position object 1, P1X#,P1Y#,P1Z#
if object collision(1,CheckObject) = 0
EmptySpace = EmptySpace + 1
endif
P1Y# = P1Y# + Gravity#
position object 1, P1X#,P1Y#,P1Z#
else
EmptySpace = EmptySpace + 1
endif
ObjectsChecked = ObjectsChecked + 1
next CheckObject
if EmptySpace = ObjectsChecked
MyAcceleration# = MyAcceleration# - Gravity#
endif
endif
if MyAcceleration# <> 0.0
P1Y# = P1Y# + MyAcceleration#
position object 1, P1X#,P1Y#,P1Z#
EmptySpace = 0 : ObjectsChecked = 0
for CheckObject = 6 to 12
if object collision(1,CheckObject) > 0
P1Y# = P1Y# - MyAcceleration#
position object 1, P1X#,P1Y#,P1Z#
MyAcceleration# = 0.0
else
EmptySpace = EmptySpace + 1
endif
ObjectsChecked = ObjectsChecked + 1
next CheckObject
if EmptySpace = ObjectsChecked
MyAcceleration# = MyAcceleration# - Gravity#
endif
endif
Rem Sphere Collision
for t = 1 to NumberOfFruits
if Object collision(1,t + NumberOfFruits) > 0
hide object (t + NumberOfFruits)
position object (t + NumberOfFruits),0,999,0
play sound 4
MyScore = MyScore + 100
endIf
next t
If Object collision(1,100) > 0
play sound 5
Hide object 100
position object 100, 0,999,0
MyScore = MyScore + 1000
endIf
REM MOVE CAMERA
cpZ# = Newzvalue(P1Z#,A1Y-180,200)
cpX# = Newxvalue(P1X#,A1Y-180,200)
if cpX#<-999 then cpX#=-999
if cpZ#<-999 then cpZ#=-999
if cpX#>999 then cpX#=999
if cpZ#>999 then cpZ#=999
Position camera cpX#,P1Y#+65,cpZ#
Point camera P1X#,P1Y#+35,P1Z#
REM REFRESH SCREEN
sync
rem Check Timer
if MyTimer = 0
for x = 1 to 200
if object exist(x) = 1 then delete object x
next x
backdrop off
gosub EndSection
endif
if MyTimer > 0 then MyTimer = MyTimer - 1
` REMOVED 'ENDIF' FROM HERE
loop
EndSection:
RETURN