Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / I can't close my nest!

Author
Message
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 31st Aug 2005 18:11
This is my multi-loop code. Only the second level is somewhat finished I haven't worked on the first yet. I can't run the game because it says it can't close the nest. Please help!



Rem Project: Ball Survival
Rem Created: 8/30/2005 2:08:05 PM

Rem ***** Main Source File *****

`instructions
Do
Print "Level: 1st"
Print "Mission: To get across the first half of the forest."
Print "Time Limit: None"
Print "Controls: Leftkey moves you left. Rightkey moves you right."
Print "Press enter to start"
Repeat
Until returnkey() : goto flevel:
flevel:
`camera & ball
Make Camera 1
Make Object Sphere 1,2
Color Object 1,RGB(255,128,0)
Color Backdrop 1,RGB(0,0,159)
`board
Make Object Box 101,50,1,360: Position object 101,0,-20,120: Color Object 101,RGB(0,225,0)
`loop
Do: Sync Rate 25
`controls
zpos#=zpos#+1.5
z#=z#+1.5
if rightkey() and xpos#<24 then xpos#=xpos#+1.5
if leftkey() and xpos#>-24 then xpos#=xpos#-1.5
`positions and variables
Position Object 1,xpos#,-20,zpos#-60
`camera
Point camera 1,xpos#,-20,z#+10: Position Camera 1,xpos#,-18,z#-80
Repeat
Until Zpos#=360 : goto sinstructions:
Loop


sinstructions:
Do
Print "Level: 2nd"
Print "Mission: To get across the second half of the forest."
Print "Time Limit: None."
Print "Press Enter to start!"
REPEAT
UNTIL returnkey() : goto slevel:
Loop
slevel:
`board
Make object Box 100,50,1,360: Position object 100,0,-1,120: Color Object 100,RGB(0,255,0)
`rocks
Make Object sphere 2,4: color object 2,RGB(192,192,192)
Make Object Sphere 3,4: color object 3,RGB(128,128,128)
Make Object Box 4,50,10,1: position object 4,0,5,-80
`trees
Make object cone 5,5: Position Object 5,0,2,14: color object 5,RGB(0,128,0)
Make object cone 6,5: Position Object 6,-5,2,18: Color object 6,RgB(0,128,0)
Make Object cone 7,5: Position Object 7,5,2,18: Color object 7,RgB(0,128,0)
Make Object cone 8,5: Position object 8,10,2,30: Color object 8,RgB(0,128,0)
Make Object Cone 9,5: Position Object 9,15,2,30: Color object 9,RgB(0,128,0)
Make Object Cone 10,5: Position Object 10,20,2,30: Color object 10,RgB(0,128,0)
Make Object Cone 11,5: Position Object 11,25,2,30: Color object 11,RgB(0,128,0)
Make Object Cone 12,5: Position Object 12,-10,2,30: Color object 12,RgB(0,128,0)
Make Object Cone 13,5: Position Object 13,-15,2,30: Color object 13,RgB(0,128,0)
Make Object Cone 14,5: Position Object 14,-20,2,30: Color object 14,RgB(0,128,0)
Make Object Cone 15,5: Position Object 15,-15,2,30: Color object 15,RgB(0,128,0)
`wall
Make Object Box 16,35,5,5: Position Object 16,-5,2,50: Color Object 16,RGB(192,192,192)
Make OBject Box 17,15,5,5: Position Object 17,20,2,70: Color Object 17,Rgb(192,192,192)
`loop
Do
Sync Rate 25
`controls
zpos#=zpos#+1.5
z#=z#+1.5
if rightkey() and xpos#<24 then xpos#=xpos#+1.5
if leftkey() and xpos#>-24 then xpos#=xpos#-1.5
`positions and variables
Position Object 1,xpos#,0,zpos#-60
`camera
Point camera 1,xpos#,0,z#+10: Position Camera 1,xpos#,2,z#-80
`rocks
position object 2,17,2,rz#+220: Position object 3,-17,2,rz#+220
rz#=rz#-3
If object collision(2,4) or object collision(3,4) then rz#=0
If object collision(1,2) or object collision(1,3) then zpos#=0:z#=0
`trees
If object collision(1,5) then zpos#=0:z#=0
If object collision(1,6) then zpos#=0:z#=0
If object collision(1,7) then zpos#=0:z#=0
If object collision(1,8) then zpos#=0:z#=0
If object collision(1,9) then zpos#=0:z#=0
If object collision(1,10) then zpos#=0:z#=0
If object collision(1,11) then zpos#=0:z#=0
If object collision(1,12) then zpos#=0:z#=0
If object collision(1,13) then zpos#=0:z#=0
If object collision(1,14) then zpos#=0:z#=0
If object collision(1,15) then zpos#=0:z#=0
`wall
If object collision(1,16) then zpos#=0:z#=0
If object collision(1,17) then zpos#=0:z#=0
Repeat: Until Zpos#=360 : Goto Tinstructions:

Tinstructions:
Do
Print "press return key"
Repeat
Until returnkey()

Mysteries Surround You
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 31st Aug 2005 20:09 Edited at: 31st Aug 2005 20:16
When you write code it's best to have spaces to line up the all the loops... that way you can see where they start and finish. Most of your "loops" have been remed off and some "do"'s don't have loops. I added spaces to your code so you can see it better (to help you fix it yourself)... but I didn't change anything. I'm sure you can get it now that you can see your code better. If you still have problems post again.



Also there's no need to have "Repeat Until returnkey()" when all you need is "wait key" or "suspend for key". Suspend and wait look for any key being pressed to continue the code. And you don't need a goto statement (or label) when you just want to go to the next line (that isn't a loop).
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 31st Aug 2005 20:31
Thanks alot!!

Mysteries Surround You
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 31st Aug 2005 21:20 Edited at: 31st Aug 2005 21:22
Several things I noticed about the code -- I've splits the nests up a bit..












...maybe one day I'll finish a project

Login to post a reply

Server time is: 2024-11-27 18:51:49
Your offset time is: 2024-11-27 18:51:49