Something very simple, yet satisfying.
Blackpool Pier Style Penny Shoot.
No media, here's the code
` ++++++++++++++ blackpool pier style penny shoot +++++++++++++++
sync on : randomize timer()
` coin image
cls rgb(155,155,166)
for x=1 to 256 step 14
ink rgb(33+rnd(20),33+rnd(20),43+rnd(20)),0
line x,0,256,256-x
line x+4,256,0,256-x-4
line x,256,256,x
line 252-x,0,0,252-x
next x
get image 1,0,0,256,256
` wood image
create bitmap 1,256,256
cls rgb(155,65,0)
for x=1 to 256 step 14
ink rgb(111+rnd(20),45+rnd(20),0),0
line x,0,256,256-x
line x+4,256,0,256-x-4
line x,256,256,x
line 252-x,0,0,252-x
next x
ink rgb(111,45,0),0
box 0,0,256,5 : box 0,0,5,256 : box 251,0,256,256 : box 0,251,256,256
blur bitmap 1,6
get image 2,0,0,256,256
center text 128,20,"Oldfashioned"
center text 128,50,"Blackpool Style"
center text 128,80,"Penny Shute"
center text 128,140,"Best Machine on the Pier"
center text 128,180,"aim and click"
get image 4,0,0,256,256
delete bitmap 1
` metal image
create bitmap 1,256,256
cls rgb(155,155,166)
for x=1 to 256 step 10
ink rgb(33+rnd(20),33+rnd(20),43+rnd(20)),0
line x,0,256,256-x
line x+4,256,0,256-x-4
line x,256,256,x
line 252-x,0,0,252-x
next x
blur bitmap 1,8
get image 3,0,0,256,256
delete bitmap 1
`
`
phy start
`
` materials
phy make material 1,"coin"
phy set material restitution 1, 0.1
phy build material 1
phy make material 2,"shute"
phy set material restitution 2, 0.1
phy build material 2
phy make material 3,"table"
phy set material static friction 3,0.1
phy set material dynamic friction 3,0.1
phy set material restitution 3,0.0
phy build material 3
`
` table plate 1
make object box 1,100,10,70
texture object 1,2
phy make rigid body dynamic box 1,3
phy set rigid body kinematic 1, 1
`
` table plate 2
make object box 2,100,10,50
texture object 2,2
phy make rigid body dynamic box 2,3
phy set rigid body kinematic 2, 1
`
` table plate 3
make object box 3,100,10,60
texture object 3,2
phy make rigid body dynamic box 3,3
phy set rigid body kinematic 3, 1
`
` table side
make object box 4,5,34,150
position object 4,-50,0,0
texture object 4,2
phy make rigid body static box 4,3
`
` table side
make object box 5,5,34,150
position object 5,50,0,0
texture object 5,2
phy make rigid body static box 5,3
`
` drop box
make object box 6,10,10,10
make object cylinder 2001,4
scale object 2001,225,600,230
make mesh from object 2001,2001
if file exist("cymesh.x")=1 then delete file "cymesh.x"
save mesh "cymesh.x",2001
delete object 2001
load object "cymesh.x",2001
position object 2001,0,0,0
perform csg difference 6,2001
delete object 2001
if file exist("cymesh.x")=1 then delete file "cymesh.x"
set object 6,1,0,0
scale object 6,1200,100,320
texture object 6,3
position object 6,0,-32,66
phy make rigid body static mesh 6
make object box 7,120,1,30
position object 7,0,-38,66
texture object 7,3
phy make rigid body static box 7
`
` head peice
make object box 8,100,70,10
position object 8,0,40,-65
texture object 8,4
`
` back white
make object sphere 9,360
position object 9,0,0,0
color object 9,rgb(255,255,255)
set object 9,1,0,0
`
` coin shute
make object box 13,2,1,70
make mesh from object 13,13
scale limb 13,0,100,20,100
add limb 13,1,13
offset limb 13,1,-1,3,0
rotate limb 13,1,0,0,90
scale limb 13,1,200,20,100
add limb 13,2,13
offset limb 13,2,1,3,0
rotate limb 13,2,0,0,90
scale limb 13,2,200,20,100
ghost object on 13
set object 13,0,1,1
phy make rigid body dynamic mesh 13,2
phy set rigid body kinematic 13,1
`
` 200 coins
for t = 101 to 300
make object sphere t,8
scale object t, 7,100,100
position object t,0,40,70
texture object t,1
hide object t
next t
`
` lights and camera
set ambient light 14
color light 0,0
make light 1 : make light 2 : make light 3 : set spot light 3,99,99 : position light 3,0,60,100 : point light 3,0,-15,0
position camera 0,70,150 : point camera 0,-10,0
`
`
do
`
` plate movement control
if back=0 then inc z#,0.05
if z#>20 then back=1
if back=1 then dec z#,0.05
if z#<0 then back=0
phy set rigid body kinematic position 1, 0, -5, 10-z#
phy set rigid body kinematic position 2, 0, 4, -50+(z#/1.2)
phy set rigid body kinematic position 3, 0, -14, 30+(z#/1.5)
`
` coin shoot control
ya=ya+mousemovex()
if ya<-30 then ya=-30
if ya>30 then ya=30
phy set rigid body kinematic rotation 13,340,ya,0
phy set rigid body kinematic position 13,0,30,70
`
` turn on the next coin
if mouseclick()=1
n=n+1
show object 100+n
yrotate object 100+n,ya
phy make rigid body dynamic box 100+n,1
phy set rigid body mass 100+n,200
wait 200
endif
`
` set gravity (heavy to speed things up)
phy set gravity 0,-250,0
`
` collision stuff (makes new coin rigid body without a material) .... (stops that annoying sliding)
hit1 = phy get collision data ( )
c1 = phy get collision object a ( )
c2 = phy get collision object b ( )
if c1>100 and c2>1 and c2<6
phy delete rigid body 100+n
phy make rigid body dynamic box 100+n
endif
`
` control lights
z=z#
position light 1,-500+(z#*40),0,-265 : color light 1,rgb(255,0,z*5)
position light 2,500-(z#*40),0,-265 : color light 2,rgb(z*5,255,0)
`
`
phy update
sync
loop
miki.
in the end