here is a couple of simple functions that might help...one is for the movement and the other for recoil...be sure to make wepmovecounter and recoilcounter global....this code was given to me by: bazza...
Function WepsMovement()
If WepMoveCounter<8 ;If the counter is less than 8
MoveEntity Shotgun,0,0,.04 ;Move the shotgun backward
EndIf
If WepMoveCounter>8 ;If the counter is greater than 8
MoveEntity Shotgun,0,0,-.04 ;Move the shotgun forward
EndIf
If WepMoveCounter=16 ;If the counter =16 then movement fully completed
WepMoveCounter=0 ;set the counter back to 0
Return ;Jump out of this function
EndIf
WepMoveCounter=WepMoveCounter+1 ;increse the counter
End Function
;Recoils the weapon when it's fired using another counter variable
Function Recoil()
If RecoilCounter<1 ;If the RecoilCounter is less then 1
MoveEntity Shotgun,0,0,-.5 ;Move the shotgun backward
EndIf
If RecoilCounter>1 ;If the RecoilCounter is grater then 1
MoveEntity Shotgun,0,0,.5 ;Move the shotgun forward
EndIf
If RecoilCounter=2 ;recoil completed
RecoilFlag=0 ;re-set the flag
RecoilCounter=0 ;and the counter
Return ;Jump out of this function
EndIf
ReCoilCounter=ReCoilCounter+1 ;Increase the counter
End Function
|