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 / noob menu problem....

Author
Message
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 03:31
i have mad a 3d pong. The game works fine by itself. Now I made a menu, but have no Idea how to insert my game into the menu. thanx in advance. Code is below..

Game


`sync stuff
sync on
sync rate 0

`Make background
load bitmap "stars.bmp",1
get image 1,0,0,256,256
delete bitmap 1

`random
randomize timer()

`Hide mouse
hide mouse

`autocam
autocam off

`make top
Make object box 1,30,1,1
color object 1,rgb(100,200,0)
make object collision box 1,-15,-.5,-.5,15,.5,.5,0

`make sides
make object box 2,1,24,1
make object collision box 2,-.5,-12,-.5,.5,12,.5,0
color object 2,rgb(100,200,0)
Position object 2,-15,-11.5,0
make object box 3,1,24,1
make object collision box 3,-.5,-12,-.5,.5,12,.5,0
color object 3,rgb(100,200,0)
Position object 3,15,-11.5,0

`make invisable barrior
Make object box 6,30,1,1
hide object 6

`color object 1,rgb(100,200,0)
make object collision box 6,-15,-.5,-.5,15,.5,.5,0
position object 6,0,-25,0

`Make Player
make object box 4,6,1,1
make object collision box 4,-3,-.5,-.5,3,.5,.5,0
color object 4,rgb(0,0,255)

`player position variables
plx#=object position x(1)
ply#=object position y(1)
plz#=object position z(1)

`Make ball
make object sphere 5,.8
make object collision box 5,-.4,-.4,-.4,.4,.4,.4,0

`music
load music "1.mid",1
loop music 1

`reset
Reset:

`Ball variables
bx#=0
by#=-12
bsy#=.05
bsx#=.05

`color variables
colorred#=rnd(255)
colorgreen#=rnd(255)
colorblue#=rnd(255)

`player variables
pl1x#=0
pl1y#=-23
plsx#=0
pls#=.3
mover#=0
movel#=0
colidey#=0
colidex#=0
x#=.06
rndvar#=rnd(.003)
score#=0

`main loop
do

texture backdrop 1

`score
set cursor 10,2
print "Score ";score#

`Position player
position object 4,pl1x#,pl1y#,0

`position ball
position object 5,bx#,by#,0

`start ball
bx#=bx#+bsx#
by#=by#+bsy#

`Deflection
if object collision(5,1)>0
bsy#=0-x#
endif
if object collision(5,3)>0
bsx#=0-x#
endif
if object collision(5,2)>0
bsx#=x#
endif
if object collision(5,4)>0
inc x#,.004+rndvar#
score#=score#+1
bsy#=x#
endif

`Stop player
if object collision(4,2)>0
movel#=1
else
movel#=0
endif
if object collision(4,3)>0
mover#=1
else
mover#=0
endif

`end
If by#
"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 3rd Mar 2003 03:32
Just make your game a sub routine, by starting at the beginning of your game (NOT MENU!!) with game: and closing it with return eg

game:
mycode
return

Then in your menu you say

if (mouseclick code here) then goto game

Hope this helps you

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 03:32
one more try......


menu



game



"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 3rd Mar 2003 03:33
Lol we posted at the same time

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 03:34
fast reply, thanx alot rpgamer

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 03:36
i just tried that, but there is some loop problems

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 3rd Mar 2003 03:41
Shouldnt be........

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 03:50
check out the menu. i don't think ther can be a gosub with a do loop at the gosub.

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 03:55
sorry to burden tou, but one more problem. When your done with playing and want to go back to the menu, how do you delete all the objects so if you go back, it won't say 'object already exists'. thanx

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 3rd Mar 2003 04:12
i fixed my problem. I used the game as a function. I fixed all other problems to. Thanx alot.

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 3rd Mar 2003 14:06
No prob. The way to use a GOTO would be like this

game:
do
Here is my gamecode
if mouseclick()=1 then goto subgame
loop
return

subgame:
do
mygamecode
loop
return

See? You dont put the goto's inside the main loop.

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!

Login to post a reply

Server time is: 2024-11-24 04:34:13
Your offset time is: 2024-11-24 04:34:13