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 / my begining code

Author
Message
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 29th Jul 2004 06:29
for some reason when i try to make it to where you click on exit it exit and when you click on new game it starts a new game so on so fourth heres the code please help.


Rem Project: Midtime
Rem Created: 7/21/2004 10:42:00 AM

Rem ***** Main Source File *****
sync on
sync rate 0


`-------------------- Select screen -------------------------------
StartPrompt:
cls
clear entry buffer
load image "Midtime title.jpg", 1
paste image 1, 155,120
center text 200, 400, "[N]ew Game"
center text 330, 400, "[L]oad Game"
center text 450, 400, "[E]xit Game"
sync

Select upper$(INKEY$())
Case 1, "N": gosub NewGameInit : EndCase
Case 2, "L": gosub LoadGameInit: EndCase
Case 3, "E": Gosub Quit: Endcase
Case default: Goto StartPrompt :Endcase
EndSelect
gosub main
wait key

`------------------------------------------------------------------
`Game typr initialization

NewGameInit:
`new game initialization code
test$="newgame was processed"
gosub main
return

LoadGameInit:
`Load game initialization
test$="load game was processed"
return

quit:
`cleanup resources
test$="quit was processed - press any key"
print test$
sync
wait key
end
return

`****************** Main Game Loop
main:
do
`cls
text 10,20,">"+test$
if mouseclick()=1
goto StartPrompt
endif
sync
loop
return

Chaos Games
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 29th Jul 2004 08:02
oh ya and it dont work it just closes?

Chaos Games
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 29th Jul 2004 12:51
Lol, it is working, you just can't see it! Use the waitkey command for DBP and suspend for key command for DBC.

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 29th Jul 2004 13:26
thank you ocean runner, but how would i make it do something if you click it? and now its not showing the text or the picture please help?

Rem Project: Midtime
Rem Created: 7/21/2004 10:42:00 AM

Rem ***** Main Source File *****
sync on
sync rate 0
wait key

`-------------------- Select screen -------------------------------
StartPrompt:
cls
clear entry buffer
load image "Midtime title.jpg", 1
paste image 1, 155,120
center text 200, 400, "[N]ew Game"
center text 330, 400, "[L]oad Game"
center text 450, 400, "[E]xit Game"
sync

Select upper$(INKEY$())
Case 1, "N": gosub NewGameInit : EndCase
Case 2, "L": gosub LoadGameInit: EndCase
Case 3, "E": Gosub Quit: Endcase
Case default: Goto StartPrompt :Endcase
EndSelect
gosub main
wait key

`------------------------------------------------------------------
`Game typr initialization

NewGameInit:
`new game initialization code
test$="newgame was processed"
gosub main
return

LoadGameInit:
`Load game initialization
test$="load game was processed"
return

quit:
`cleanup resources
test$="quit was processed - press any key"
print test$
sync
wait key
end
return

`****************** Main Game Loop
main:
do
`cls
text 10,20,">"+test$
if mouseclick()=1
goto StartPrompt
endif
sync
loop
return

Chaos Games
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Jul 2004 11:16
It closes because there's a problem with the case statement, you shouldn't use numbers when you're checking letters.

Try this:

gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 31st Jul 2004 01:33
thanks sparky but it doesn't show anything its just black screen


Rem Project: Midtime
Rem Created: 7/21/2004 10:42:00 AM

Rem ***** Main Source File *****
sync on
sync rate 0
wait key

`-------------------- Select screen -------------------------------
StartPrompt:
cls
clear entry buffer
load image "Midtime title.jpg", 1
paste image 1, 155,120
center text 200, 400, "[N]ew Game"
center text 330, 400, "[L]oad Game"
center text 450, 400, "[E]xit Game"
sync

Select upper$(INKEY$())
Case "N": gosub NewGameInit : EndCase
Case "L": gosub LoadGameInit: EndCase
Case "E": Gosub Quit: Endcase
Case default: Goto StartPrompt :Endcase
EndSelect
gosub main
wait key

`------------------------------------------------------------------
`Game typr initialization

NewGameInit:
`new game initialization code
test$="newgame was processed"
gosub main
return

LoadGameInit:
`Load game initialization
test$="load game was processed"
return

quit:
`cleanup resources
test$="quit was processed - press any key"
print test$
sync
wait key
end
return

`****************** Main Game Loop
main:
do
`cls
text 10,20,">"+test$
if mouseclick()=1
goto StartPrompt
endif
sync
loop
return

Chaos Games
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Jul 2004 08:40
Remove the wait key command from line 7.

gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 31st Jul 2004 08:56
thax sparky for helping me so much

Chaos Games
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 31st Jul 2004 09:00
it shos all the stuff although when i click exit it doesn't exit

Chaos Games
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Jul 2004 09:12
If you mean click with the mouse, no you'll have to code some sort of mouse detection code to figure out what's being clicked then taking the appropriate action.
gothboy 101
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Watonga, ok, usa
Posted: 31st Jul 2004 09:39
ok thanx

Chaos Games
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 31st Jul 2004 10:05
uhh dude just a suggestion, you posted 4 messages in like one hour, try using the EDIT button instead. Just a suggestion to save TGC some forum space

Login to post a reply

Server time is: 2024-09-22 18:31:20
Your offset time is: 2024-09-22 18:31:20