`set gun holding-limb position josephthomsongunswayeffectcodegunoffsetx# as float = 15.0 josephthomsongunswayeffectcodegunoffsety# as float = -20.0 josephthomsongunswayeffectcodegunoffsetz# as float = 20.0 `variables josephthomsongunswayeffectcodexpos# as float josephthomsongunswayeffectcodezpos# as float josephthomsongunswayeffectcodespeed# as float = 10.0 josephthomsongunswayeffectcodexlook# as float josephthomsongunswayeffectcodeyang# as float josephthomsongunswayeffectcodelookspeed# as float = 0.2 `the gun bobbing values josephthomsongunswayeffectcodegunbobspeed# as float = 6.0 josephthomsongunswayeffectcodegunbobmove# as float = 3.0 josephthomsongunswayeffectcodegunbobheight# as float = 1.5 josephthomsongunswayeffectcodegunbobang# as float josephthomsongunswayeffectcodegunturnang# as float josephthomsongunswayeffectcodegunlookang# as float
rem @@@@@@@@ rem @@@@@@@@ rem @@@@@@@@ if thisplayerforwardplayermovment + thisplayerbackwardsplayermovment + thisplayerrightplayermovment + thisplayerleftplayermovment > 0 if thisplayerforwardplayermovment = 1 inc josephthomsongunswayeffectcodexpos#,sin(josephthomsongunswayeffectcodeyang#)*josep hthomsongunswayeffectcodespeed# inc josephthomsongunswayeffectcodezpos#,cos(josephthomsongunswayeffectcodeyang#)*josep
hthomsongunswayeffectcodespeed# endif if thisplayerbackwardsplayermovment = 1 dec josephthomsongunswayeffectcodexpos,sin(josephthomsongunswayeffectcodeyang)*josepht homsongunswayeffectcodespeed dec josephthomsongunswayeffectcodezpos,cos(josephthomsongunswayeffectcodeyang)*josepht homsongunswayeffectcodespeed endif if thisplayerrightplayermovment = 1 inc josephthomsongunswayeffectcodexpos#,cos(josephthomsongunswayeffectcodeyang#)*josep hthomsongunswayeffectcodespeed# inc josephthomsongunswayeffectcodezpos#,sin(josephthomsongunswayeffectcodeyang#)*josephthomsongunswayeffectcodespeed# endif if thisplayerleftplayermovment = 1 dec josephthomsongunswayeffectcodexpos#,cos(josephthomsongunswayeffectcodeyang#)*josep hthomsongunswayeffectcodespeed# dec josephthomsongunswayeffectcodezpos#,sin(josephthomsongunswayeffectcodeyang#)*josephthomsongunswayeffectcodespeed# endif `increase gun-bobbing angle to get gun bobbing josephthomsongunswayeffectcodegunbobang# = wrapvalue(josephthomsongunswayeffectcodegunbobang#+josephthomsongunswayeffectcodeg unbobspeed#) else `otherwise slowly change the value to nothing to bring the gun to the centre again josephthomsongunswayeffectcodegunbobang# = curveangle(0,josephthomsongunswayeffectcodegunbobang#,10) endif
`control the gun swaying according to how much the player is turning josephthomsongunswayeffectcodegunturnang# = curveangle(wrapvalue(mousemovex()),josephthomsongunswayeffectcodegunturnang#,10) josephthomsongunswayeffectcodegunlookang# = curveangle(wrapvalue(mousemovey()),josephthomsongunswayeffectcodegunlookang#,10) `position the gun-holding limb and rotate it to give swaying effect offset limb 1,20,josephthomsongunswayeffectcodegunoffsetx#+sin(josephthomsongunswayeffectcodeg unbobang#)*josephthomsongunswayeffectcodegunbobmove#,josephthomsongunswayeffectcod egunoffsety#+abs(cos(josephthomsongunswayeffectcodegunbobang#))*josephthomsongunsw ayeffectcodegunbobheight,josephthomsongunswayeffectcodegunoffsetz# rotate limb 1,20,josephthomsongunswayeffectcodegunlookang#,josephthomsongunswayeffectcodeguntu rnang#,0 `turn player
josephthomsongunswayeffectcodeyang# = wrapvalue(josephthomsongunswayeffectcodeyang# + mousemovex()*josephthomsongunswayeffectcodelookspeed#) josephthomsongunswayeffectcodexlook# = wrapvalue(josephthomsongunswayeffectcodexlook# + mousemovey()*josephthomsongunswayeffectcodelookspeed#) `position player object and camera position object 1,josephthomsongunswayeffectcodexpos#,object position y(1),josephthomsongunswayeffectcodezpos# rotate object 1,object angle x(1),josephthomsongunswayeffectcodeyang#,object angle z(1) pitch object down 1,josephthomsongunswayeffectcodexlook#