Hi everybody!
I'm new here and with DBPro and I started to make a Pong game for my first game (in 3d). The problem is that the collision with the sphere and the boxes dont work well. I would like to know if somebody can help me.
PS: sorry for my bad english
cls: sync on: hide mouse
set display mode 640,480,16
rem make the 4 boxes and the ball
make object box 1,10,40,10
make object box 2,10,40,10
make object box 11,250,5,10
make object box 12,250,5,10
make object sphere 3,6
rem position them...
position object 1,-80,0,130
position object 2,80,0,130
position object 11,0,-75,130
position object 12,0,75,130
position object 3,0,0,130
yrotate object 3,90
xrotate object 3,10
rem puts the camera
position camera 0,0,0
xrotate camera 0
rem main loop
do
if upkey()=1 and object collision(1,12)=0 then move object up 1,0.7
if downkey()=1 and object collision(1,11)=0 then move object down 1,0.7
if scancode()=30 and object collision(2,12)=0 then move object up 2,0.7
if scancode()=44 and object collision(2,11)=0 then move object down 2,0.7
gosub move_ball
gosub check_collision
sync
loop
move_ball:
move object 3,0.7
return
check_collision:
if object collision(1,3) or object collision(2,3) or object collision(3,12) or object collision(3,11)
rem Well, i dont know if this is right but it works pretty well with the paddles
rem but not for the walls ??? maybe there's something wrong with this or with the collision
xrotate object 3,(object angle x(3)*-1)+180
endif
return