here it is with a bit added to start the ball going down faster and when it hits a wall to randomly off in .a direction and a bit to make the bat move.
Rem Project: bouningbat1
Rem Created: Saturday, January 28, 2012
Rem ***** Main Source File *****
Rem Project: Arkenoid
Rem Created: Thursday, January 26, 2012
Rem ***** Main Source File *****
set display mode 800,600,32
sync on
sync rate 60
autocam off
set camera range 1,1000
set normalization on
hide mouse
set window off
load image "bdrop.jpg",1
global top_screenedge
global left_screenedge
global right_screenedge
global camz
global adder
global ground_object_num,lid_object_num
global totalUScroll#
global scrollIncrement#
global leftbox,rightbox,topbox,player_bat, playerball,playerx,playery,playerz
global ballx,bally,ballz,startbrick_num
global startxpos
global objsizex,objsizey
global bottom_screenedge
bottom_screenedge = -210
startbrick_num = 100
leftbox=-320
rightbox=11
topbox=12
player_bat=151
playerball=152
totalUScroll# = 0.0
scrollIncrement# = 0.0009
left_screenedge =-110
right_screenedge = 200
top_screenedge =0
startxpos=left_screenedge-20
ground_object_num=150
lid_object_num=155
objsizex=640
objsizey=480
playerx=0
playery=bottom_screenedge
camz=0
`********************************* rem make the arena *********************************
phy start
levelnum=1
load object "playerbat.x",player_bat
scale object player_bat,200,200,200
PHY load RIGID BODY DYNAMIC MESH player_bat,"bat.b",1 :rem <<<<<<<<<< added
phy make material 1, "bouncy"
phy set material restitution 1, 1.0
phy build material 1
make_arena(objsizex,objsizey)
make_objects()
phy add rigid body force playerball, 0, -10000, 0, 0 :rem start the ball going down faster.
do
rem to check what was going where.
`text 0,70,str$(object size z(player_bat))
`text 0,10,str$(object position x(player_bat))
`text 0,20,str$(object position y(player_bat))
`text 0,30,str$(object position z(player_bat))
`text 0,40,str$(object position x(playerball))
`text 0,50,str$(object position y(playerball))
`text 120,60,str$(object size z(playerball))
`text 120,190,str$(a)
if phy get collision data ( ) = 1
a = phy get collision object a ( )
`b = phy get collision object b ( )
endif
if a=151
phy add rigid body force playerball, 0, 10000, 0, 0
endif
if a=130 :rem bouce off wall which everone this is?
phy add rigid body force playerball, rnd(10000)-500, -10000, rnd(10000)-500, 0
endif
if leftkey()
playerx=playerx-6
endif
if rightkey()
playerx=playerx+6
endif
if totalUScroll# < 1.0
scroll object texture ground_object_num, scrollIncrement#, 0.0005 : inc totalUScroll#, scrollIncrement#
else
scroll object texture ground_object_num, -1.0+scrollIncrement#, 0.0005 : dec totalUScroll#, 1.0 - scrollIncrement#
endif
` position object player_bat,playerx,playery,playerz
PHY SET RIGID BODY POSITION player_bat,playerx,playery,playerz
sync
phy update
Loop
function make_arena(objsizex,objsizey)
make object box ground_object_num,objsizex,objsizey,10
make object box lid_object_num,objsizex,objsizey,10
position object lid_object_num,left_screenedge,top_screenedge,camz-20
position object ground_object_num,left_screenedge,top_screenedge,camz
position camera 0,left_screenedge-5,0,camz-420
texture object ground_object_num,1
make object box 130,10,480,10
position object 130,left_screenedge-320,top_screenedge,camz-10
make object box 131,10,480,10
position object 131,right_screenedge,top_screenedge,camz-10
phy make rigid body static mesh 131
make object box 132,objsizex,10,10
position object 132,left_screenedge,top_screenedge+230,camz -10
phy make rigid body static mesh 132
make object box 133,objsizex,10,10
position object 133,left_screenedge,top_screenedge-230,camz -10
phy make rigid body static mesh 133
endfunction
function make_objects()
playerz=camz-10
make object sphere playerball,10,10,10
position object playerball,0,0,camz-10
phy make rigid body dynamic sphere playerball,1
phy set rigid body mass playerball, 1
`phy make rigid body static mesh player_bat
phy set rigid body KINEMATIC player_bat,1: rem added
` playerz=camz-15
`position object player_bat,playerx,playery,playerz
PHY SET RIGID BODY POSITION player_bat,playerx,playery,playerz :rem added.
phy make rigid body static mesh ground_object_num
phy make rigid body static mesh lid_object_num
phy make rigid body static mesh 132
hide object lid_object_num
phy update
endfunction
Dark Physics makes any hot drink go cold.