Im making a pong game to help me get to grips with Dark Basic and I have the collision for one paddle working and used to the same technique on the edges of the court and the other paddle but the collision won't work for those objects. Please help heres the code for the game. Thankyou
Color backdrop RGB(155,155,255)
Make object box 1,2,2,6:Color object 1,RGB(255,128,0):Position object 1,-18,0,0
Make object box 2,2,2,6:Color object 2,RGB(0,128,0):Position object 2,18,0,0
Make object box 3,39,2,39:Color object 3,RGB(255,255,255):Position object 3,0,-2,0
Make object sphere 4,2:Color object 4,RGB(128,0,0):yrotate object 4,-90
Make object box 5,39,2,2:Color object 5,RGB(0,0,0):Position object 5,0,0,18
Make object box 6,39,2,2:Color object 6,RGB(0,0,0):Position object 6,0,0,-18
Position camera -30,30,-30:Point camera 0,0,-5:yrotate camera 45
set object collision on 1
set object collision on 2
set object collision on 4
Set object collision on 5
Set object collision on 6
hide mouse
sync on
Do
sync
ballangle#= = object angle y(4)
Move object 4,0.5
If upkey()=1 AND object position z(1) < 14 then position object 1,object position x(1),object position y(1),object position z(1) + 1
If downkey()=1 AND object position z(1) > -14 then position object 1,object position x(1),object position y(1),object position z(1) - 1
If leftkey()=1 AND object position z(2) < 14 then position object 2,object position x(2), object position y(2),object position z(2) + 1
If rightkey()=1 AND object position z(2) > -14 then position object 2, object position x(2), object position y(2),object position z(2) - 1
If object collision(4,5)=1 then position object 4,object position x(4),object position y(4),object position z(4) - 2:yrotate object 4,wrapvalue(ballangle# * -ballangle# + 45 + rnd(20))
If object collision(4,6)=1 then position object 4,object position x(4),object position y(4),object position z(4) - 2:yrotate object 4,wrapvalue(ballabgle# * -ballangle# + 45 + rnd(20))
If object hit(4,1)=1 then position object 4,object position x(4) + 1,object position y(4),object position z(4):yrotate object 4,wrapvalue(ballangle# * -ballangle# + 45 + rnd(20))
If object hit(4,2)=1 then position object 4,object position x(4) - 1,object position y(4),object position z(4):yrotate object 4,wrapvalue(ballablge# * -ballangle# + 45 + rnd(20))
Loop
*For every problem you come across you gain something from correcting it, I hope.