I'm trying to make a sort of 3-D Breakout game, I want to make it so that you must try to bounce the ball up and hit the red cube(s). When you hit the cube, I want the ball to bounce away, and the red block to go away. How can I make it so that when a ball hits the bottom of the cube, it'll bounce away down, and if it hits the sides, it'll bounce away sideways? Here's my code so far:
`STARTING STUFF
Sync On
Autocam Off
Hide Mouse
Position Camera 0,28,-50
`BALL & YOU
Make Object Cube 2,10
Scale Object 2,100,20,10
Position Object 2,0,0,0
make object collision box 2,-5,-2,-2,5,2,2,0
Make Object Sphere 1,3
Position Object 1,0,10,0
make object collision box 1,-1.5,-1.5,-1.5,1.5,1.5,1.5,0
`MAKE BLOCKS!
Make Object Cube 50,5
Position Object 50,0,35,0
Color Object 50,rgb(200,10,10)
make object collision box 50,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
`SET VARIABLES
px#=0
x#=0
y#=10
h_speed#=0.4
v_speed#=0.6
`MAIN GAME LOOP
Do
`BALL PHYSICS
inc x#,h_speed#
inc y#,v_Speed#
If x#<-34 or x#>34 then h_speed#=h_speed#*-1
If y#>56 then v_speed#=v_speed#*-1
Position Object 1,x#,y#,0
If Object Collision(1,2)>0
v_speed#=.2
h_speed#=h_speed#+speed#
If h_speed#>4 then h_speed#=4
If h_speed#<-4 then h_speed#=-4
endif
`MOVING BOTTOM PADDLE
If px#<-34 then px#=-34
If px#>34 then px#=34
Position object 2,px#,0,0
If leftkey()=1
px#=px#-0.7
speed#=0.5
else
speed#=0
endif
If rightkey()=1
px#=px#+0.7
speed#=0.5
else
speed#=0
endif
`****************** WHERE I NEED HELP ********************************
`Busting Brick
If Object Collision(1,50)>0
Delete Object 50
endif
`LOSING :(
If y#<-5 : Set Cursor 10,5 : Print "OHHHHHHHH" : endif
If y#<-20
wait 200
h_speed#=Rnd(1)+.1
v_speed#=.6
x#=0
y#=10
cls
endif
`END OF MAIN GAME LOOP
Sync
Loop
I will take any help!
Am I dead yet?