A bouncing Ball by Flaming Ghost13th Mar 2005 10:02
|
---|
Summary This is something fun I made while trying to make a 3-D Pong. Description I'm trying to make a pong 3-D, as I looked around, I couldn't find many tutorials on making something bounce, so here's a sphere that bounces off of two cubes. Very Simple. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Sync On Make Object Cube 1,20 position object 1,40,2,50 Make Object Cube 2,20 Position Object 2,-40,2,50 Make Object Sphere 3,10 Position Object 3,0,2,50 make object collision box 3,-5,-5,-5,5,5,5,0 horizontal_speed#=.5 vertical_speed#=0 set object collision on 3 do inc x#,horizontal_speed# position object 3,x#,y#,50 if object collision(3,0)>0 horizontal_speed#=horizontal_speed#*-1 endif sync loop |