Hey
I have just checked out this code snippet and added a litle bit on.
` fps sword and shield weapon demo
` setup
sync on: sync rate 0
` make world
make matrix 1,1000,1000,1,1
` make shield and sword
make object box 10,2,20,2
make mesh from object 1,10:delete object 10
make object cube 10,5:color object 10,rgb(0,0,0):add limb 10,1,1:offset limb 10,1,7,-7,15
add limb 10,2,1:offset limb 10,2,0,10,0
link limb 10,0,1:link limb 10,1,2
hide limb 10,1
delete mesh 1
` shield
make object plain 11,12,20
make mesh from object 1,11:delete object 11
make object cube 11,10:add limb 11,1,1
offset limb 11,1,-7,-16,15
set object cull 11,0
link limb 11,0,1
hide limb 10,0:hide limb 11,0
for ene=12 to 20
make object cube ene,70
position object ene,rnd(1000),0,rnd(1000)
color object ene,rgb(255,0,0)
next ene
do
` scancoe
set cursor 0,0
print scancode()
` move and camera
vx#=mousemovex():vy#=mousemovey()
ax#=wrapvalue(ax#+vy#)
ay#=wrapvalue(ay#+vx#)
cay#=curveangle(ay#,camera angle y(),20)
cax#=curveangle(ax#,camera angle x(),20)
` rotate camera
rotate camera cax#,cay#,0
` move
ox#=x#:oz#=z#:move=0
if keystate(17)=1 then x#=newxvalue(x#,cay#,d#):z#=newzvalue(z#,cay#,d#):move=1
if keystate(31)=1 then x#=newxvalue(x#,cay#+180,d#):z#=newzvalue(z#,cay#+180,d#):move=1
if keystate(32)=1 then x#=newxvalue(x#,cay#+90,d#):z#=newzvalue(z#,cay#+90,d#):move=1
if keystate(30)=1 then x#=newxvalue(x#,cay#-90,d#):z#=newzvalue(z#,cay#-90,d#):move=1
d#=1
` limit
if move>0
walk#=walk#+d#*4
endif
for enecol=12 to 20
if object collision(10,enecol)=1 then position object enecol,object position x(enecol),object position y(enecol)+1000,object position z(enecol) : wait 100
next enecol
` position
y#=curvevalue(60,y#,20)
if controlkey()=1 then y#=curvevalue(15,y#,20):d#=0.5
if inkey$()="z" then y#=curvevalue(-50,y#,30):d#=0.1
position camera x#,y#+sin(walk#)*3,z#
` sword position
position object 10,camera position x(),camera position y(),camera position z()
` sword fighting
if mouseclick()=1
if swingx#=0 then swingx#=1
lax#=wrapvalue(limb angle x(10,1)-90)
if lax#>180 then lax#=lax#-360
if lax#<-15 or lax#>15
if lax#<0 then swingx#=swingx#+0.03
if lax#>0 then swingx#=swingx#-0.03
else
swingx#=swingx#/1.01
endif
lay#=wrapvalue(limb angle y(10,1))
if lay#>180 then lay#=lay#-360
if lay#<-15 or lay#>15
if lay#<0 then swingy#=swingy#+0.03
if lay#>0 then swingy#=swingy#-0.03
else
swingy#=swingy#/1.01
endif
swordax#=(swordax#-vy#)+swingx#
sworday#=(sworday#-vx#)+swingy#
else
swordax#=curveangle(0,limb angle x(10,1),20)
sworday#=0
swingy#=0:swingx#=0
endif
say#=curveangle(cay#,say#,10)
sax#=curveangle(cax#,sax#,10)
rotate limb 10,0,sax#,say#,0
rotate limb 10,1,swordax#,sworday#,0
` shield
position object 11,camera position x(),camera position y(),camera position z()
rotate limb 11,0,sax#,say#,0
` shielded
if mouseclick()=2
ofx#=curvevalue(-2,ofx#,10)
ofy#=curvevalue(-10,ofy#,10)
ofz#=curvevalue(7,ofz#,10)
d#=d#/2
else
ofx#=curvevalue(-7,ofx#,10)
ofy#=curvevalue(-16,ofy#,10)
ofz#=curvevalue(15,ofz#,10)
endif
offset limb 11,1,ofx#,ofy#,ofz#
sync
loop
I am tryign to get the sword to just swipe forwards instead of all that moving about when you hold in left mouseclick. Though im not sure how to do this, any help would be great