Here I come with one of my tricks. We could use an intersect to determine how deep the sword goes through .
autocam off
sync on
hide mouse
rem enemy
make object box 1,30,30,30
position object 1,0,0,60
color object 1,rgb(0,255,0)
`intersect
make object sphere 2,2:color object 2,rgb(255,0,0)
`sword
make object triangle 3,0,0,0,1,0,30,2,0,0
color object 3,rgb(0,0,255)
position camera -20,100,-20
point camera 0,0,0
cnt=30
do
`movements
if upkey() then move object 3,0.1
if downkey() then move object 3,-0.1
if leftkey() then turn object left 3,0.2
if rightkey() then turn object right 3,0.2
`old sword positions
x#=object position x(3)
y#=object position y(3)
z#=object position z(3)
`check for collision in front
move object 3,30
`actual sword positioin
lx#=object position x(3)
ly#=object position y(3)
lz#=object position z(3)
`reset position
move object 3, -30
`distance
dis#= intersect object(1,x#,y#,z#,lx#,ly#,lz#)
position object 2,x#,y#,z#:move object right 2,1
set object to object orientation 2,3
move object 2,dis#
if object collision(1,3)>0 then cnt#=30 else cnt#=0
set cursor 0,0
print "Move Sword upkey/downkey "
print "Turn Sword leftkey/rightkey"
print "Stab ",abs(dis#-cnt#)
sync
loop
Cheers.
I'm not a grumpy grandpa
