This is a simple bowling game i created using ode...hope it helps someone...and I too have trouble with static .x objects...my dynamic ones seem to behave. Also if you explore the ODE website it explains a lot of things like the world variables...i killed the sponginess of my collisions because of the nature of the game.
cls
sync on: sync rate 60
ode start
ode set world gravity 0,-20,0
ode set world step 0.05
ode set world erp (0.2)*2.5
ode set world cfm 0:rem (10^-5)*2.5
restore pindata
load image "barrel.bmp",1
make object box 12,15,7,100
position object 12,15.5,-5,6.5
xrotate object 12,.3
texture object 12,1
make object cylinder 14,2
scale object 14,25,800,25
xrotate object 14,90
position object 14,50/3.2,0,50
color object 14,rgb(10,10,10)
ghost object on 14
ode create static box 12
ODE SETSURFACE MODE CONTACT slip2 12,1
ode set contact fdir1 12,180
gosub rerack
make object sphere 13,3,16,16
position object 13,50/3.2,5,50
color object 13,rgb(10,10,10)
ode create dynamic sphere 13
ode set contact motion2 13,100
ODE SET BODY MASS 13,800
autocam off
POSITION CAMERA object position X(13),5,object position z(13)+8
point camera object position x(2),object position y(2),object position z(2)
eng#=-.0001
balls=0
frames=1
dim frame(10,3)
while esc$<> "x"
mx=wrapvalue(mousex())
if mx>180 and mx<316 then mx=316
if mx<180 and mx>44 then mx=44
IF mx>315 or mx<45 then yrotate object 14,mx
lift#=0
if object position z(13)>49
if english#>.06 then eng#=-.0002
if english#<0 then eng#=.0002
english#=english#+eng#
ink rgb(255,255,0),rgb(0,0,255)
text 295,90,"english"
line 320,105,320,135
ink rgb(255,255,255),rgb(0,0,255)
if english#-.03<0
ink rgb(255,255,255),rgb(0,0,255)
box 320,110,320+abs((english#-.03)*10000),130,rgb(0,255,0),rgb(0,255,0) ,rgb(0+english#*(255/.03),255+(english#*(255/.03)),0) ,rgb(0+english#*(255/.03),255+english#*(255/.03),0)
else
box 320-((english#-.03)*10000),110,320,130,rgb(255+english#*(255/.03),255-(english#*(255/.03)),0) ,rgb(255+english#*(255/.03),255-(english#*(255/.03)),0),rgb(0,255,0) ,rgb(0,255,0)
endif
endif
shoot=0
peng#=.3
power#=5
while spacekey()=1 and object position z(13)>49
if power#>30 then peng#=-.3
if power#<5 then peng#=.3
power#=power#+peng#
sync
text 295,90,"english"
line 320,105,320,135
ink rgb(255,255,0),rgb(0,0,255)
line 320,105,320,135
ink rgb(255,255,255),rgb(0,0,255)
if english#-.015<0
ink rgb(255,255,255),rgb(0,0,255)
box 320,110,320+abs((english#-.03)*10000),130,rgb(0,255,0),rgb(0,255,0) ,rgb(0+english#*(255/.03),255+(english#*(255/.03)),0) ,rgb(0+english#*(255/.03),255+english#*(255/.03),0)
else
box 320-((english#-.03)*10000),110,320,130,rgb(255+english#*(255/.03),255-(english#*(255/.03)),0) ,rgb(255+english#*(255/.03),255-(english#*(255/.03)),0),rgb(0,255,0) ,rgb(0,255,0)
endif
text 400,270,"power:":box 470,250-((power#-4)*6),500,280,rgb(255,255,0),rgb(power#*6,255,0),rgb(255,255,0),rgb(power#*6,255,0)
shoot=1
endwhile
if rightkey()=1 and object position z(13)>49
shiftx#=shiftx#-.2
gosub ballbuster
endif
if leftkey()=1 and object position z(13)>49
shiftx#=shiftx#+.2
gosub ballbuster
endif
if shoot=1 and object position z(13)>49
if power#>10 then lift#=2*(power#-10)
ode add force 13,sin(mx)*-power#,lift#/6,cos(mx)*-power#,0,0,0
inc balls
lockhook#=3*(english#-.03)
shoot=0
endif
nx=object position x(13)
nz=object position z(13)
if nx<>ox or nz<>oz then still=0
if nx=ox and nz=oz and object position z(13)<49
still=still+1
endif
if object position z(13)<49
ode add force 13,lockhook#,0,0,0,0,0
endif
if object position y(13)< -2000 or still=1000
for x=2 to 11
if object exist(x)
if object position y(x) < -5
ode destroy object x
delete object x
inc frame(frames,balls)
endif
endif
next x
if balls=3 and frames=10 and frame(frames,1)+frame(frames,2)<10
goto no3rdball
else
if balls=3 and frames=10
gosub rerack
gosub ballbuster
endif
if balls=2 and frames<10 or balls=1 and frame(frames,1)=10 and frames<10
frames=frames+1
balls=0
endif
if balls=0 then gosub rerack
gosub ballbuster
endif
endif
control camera using arrowkeys 0,1,0
ox=nx
oz=nz
ode update
sync
text 20,80,"fps: "+str$(screen fps())
for x= 1 to frames
text x*20,20,str$(frame(x,1))
text x*20,40,str$(frame(x,2))
if frames=10 then text x*20,60,str$(frame(x,3))
next x
esc$=inkey$()
no3rdball:
if frames=10 and balls=3
esc$="x"
for x=1 to 10
rem ots=ts
for y=1 to 2
ts=ts+frame(x,y)
next y
if frame(x,1)<10 and frame(x,1)+frame(x,2)=10 and frame(x,1)<10 then ts=ts+frame(x+1,1)
if x<9 and frame(x,1)=10
ts=ts+frame(x+1,1)
if frame(x+1,1)=10
ts=ts+frame(x+2,1)
else
ts=ts+frame(x+1,2)
endif
endif
next x
if frame(9,1)=10 then ts=ts+frame(10,1)+frame(10,2)
if frame(10,1)=10 then ts=ts+frame(10,2)+frame(10,3)
if frame(10,2)=10 then ts=ts+frame(10,3)
text 320,200,"Total Score: "+str$(TS)
sync
wait key
endif
endwhile
ode end
end
pindata:
data 50,20
data 45,30,55,30
data 40,40,50,40,60,40
data 35,50,45,50,55,50,65,50
ballbuster:
ode destroy object 13
position object 13,50/3.2+shiftx#,1,50
position object 14,50/3.2+shiftx#,0,50
color object 13,rgb(10,10,10)
ode create dynamic sphere 13
ODE SET BODY MASS 13,800
ode set contact motion2 13,100
return
rerack:
restore pindata
for x=2 to 11
if object exist(x)
ode destroy object x
delete object x
endif
load object "pins.x",x
read xx,zz
position object x,xx/3.2,2,0-zz/1.5
ODE SET BODY MASS x,0
ode create dynamic triangle mesh x
ode set contact motion2 x,80
next x
return
Ink all over the screen...and dang it! Signature still does not show.