First of all, hi there to all the game development community once again. I have been quite absent for a while, so I am a little downgraded to the stuff, but at least I have the recent news, so I hope everyone is getting well in game programming with this wonderful language of DarkBasic Pro.
Well, I hope you can help me in this:
I am making a small videogame for the final computer class proyect (basically, it was free topic, so obviosly I chose game programming). Basically, by proyect is a tutorial on videogame development, not focusing too much on game programming but rather showing the main process in a correct game progress to understand the basic ideas of the development and organization of any computer program proyect.
So I am making a simple ping pong game, but I don't know if it has been the time that took away some of my programming skills, thus I am getting quite some problems in making the videogame. Basically, I just need help in the following:
Do you know of some way to program a ping pong batter in order to move further in depth as the mouse moves up on the screen, and viceversa, while doing something similar with the horizontal movement?
To be more clear, I want to acheive a effect like this in DarkBasic Pro:
http://www.gizdic.com/freegames/gamespages/tabletennis.htm
As you can see, you move the batter with the mouse, moving it further into the table as you move the mouse vertically up. I need to get a similar effect in a 3D game to complete my game, but (yes you can laugh at me and call me a fool), I am getting a hard time getting it to work, so I will really appreciate your help.
Carlos
PS: If you want to see the actual code in case you know how to implement it properly, here is the data:
REM Project: PingPong3D-Junior Version
REM Created: 09/06/2008 07:48:46 p.m.
REM
REM ***** Main Source File *****
REM
rem main settings
set window on : set window title "Ping Pong 3D-Junior Version"
sync on : sync rate 60
backdrop off
hide mouse
rem load and prepare media
gosub _mainvars
gosub _batter
gosub _table
gosub _mediamisc
gosub _mainmenu
gosub _mainloop
rem mainmenu
_mainmenu
return
rem main loop
_mainloop:
rem set camera position
position camera 0,10,38
do
mybatterx#=object position x(mybatter)
mybattery#=object position y(mybatter)
mybatterz#=object position z(mybatter)
enemybatterx#=object position x(enemybatter)
enemybattery#=object position y(enemybatter)
enemybatterz#=object position z(enemybatter)
loop
_mainvars:
rem set basic start variables
gamestart=0
gameend=0
gravity#=0
bouncepower=0
batter=1
mybatter=2
enemybatter=3
ntable=4
skybox=5
nball=6
starposx1#=
starposy1#=
starposz1#=
starposx2#=
starposy2#=
starposz2#=
return
_batter:
rem create and set batter
load object "\Media\Objects\pingpong_batter.x",batter
clone object mybatter,batter
clone object enemybatter,batter
delete object batter
rem set mybatter and store vars
set object cull mybatter,0
set object collision off
set object smoothing mybatter,60
position object mybatter,starposx1#,starposy1#y,starposz1#
rotate object mybatter,0,0,10
scale object mybatter 1.2,1.2,1.2
mybatterx#=object position x(mybatter)
mybattery#=object position y(mybatter)
mybatterz#=object position z(mybatter)
rem set enemybatter
set object cull enemybatter,0
set object coliision off
set object smoothing enemybatter,60
position object enemybatter,starposx2#,starposy2#,starposz2#
rotate object enemybatter 0,0,10
scale object mybatter 1.2,1.2,1.2
enemybatterx#=object position x(enemybatter)
enemybattery#=object position y(enemybatter)
enemybatterz#=object position z(enemybatter)
rem coliision boxes are set inside main routine loop
return
_table:
rem create game table
load object "\Media\Objects\table_main2.x",ntable
set object cull ntable,0
set object collision off
rotate object ntable,0,90,0
scale object ntable 500,500,500
position object ntable 0,0,0
rem set collision boxes
make object collision box ntable,14,-5,25,-14,3,-25,1
make object collision box ntable,14,0,2,-14,6,-2
return
_mediamisc:
rem set skybox
make object box skybox, 1200,1000,1200
load image "\Media\Textures\wood_texture2.gif",1
texture object skybox,1
rem preload audio
load sound "\Media\Audio\Sounds\hit02.mp3",1
load sound "\Media\Audio\Sounds\hit043.mp3",2
load sound "\Media\Audio\Sounds\hit325.mp3",3
load sound "\Media\Audio\Sounds\tootle.mp3",4
load sound "\Media\Audio\Sounds\bgmusic.mp3",5
load music "\Media\Audio\Sounds\win.mid",6
load music "\Media\Audio\Music\tunes_song.mid",7
load music "\Media\Audio\Music\canon_piano.mid",8
rem make pingpong ball
make object sphere nball,1
set object collision on nball
set object collision to spheres nball
color object nball,rgb(00,90,15)
return
return
Have a nice day