-
-
Save MrSapps/822151b64f30f19b33336b2b897b9d94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function init(self) | |
| -- BEGIN STATE DATA | |
| local states = {} | |
| states.AbeStandToWalk = { | |
| NextAnimation ='AbeWalking', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=2.777771, | |
| YSpeed=0 | |
| } | |
| states.AbeWalking = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=2.777771, | |
| YSpeed=0 | |
| } | |
| states.AbeWalking.Sounds = {} | |
| states.AbeWalking.Sounds[4] = { | |
| 'FOOTSTEP', | |
| } | |
| states.AbeWalking.Sounds[14] = { | |
| 'FOOTSTEP', | |
| } | |
| states.AbeWalking.Conditions = {} | |
| states.AbeWalking.Conditions[0] = { | |
| AnyTime = true, | |
| AtFrames = { | |
| 11, | |
| 2, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToFallingFromTrapDoor', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = false, | |
| }, | |
| } | |
| states.AbeWalking.Conditions[1] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 2, | |
| 11, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeWalkingToRunningMidGrid', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Running = true, | |
| RunOtherDirection = false, | |
| }, | |
| } | |
| states.AbeWalking.Conditions[2] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 2, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeWalkToStand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = false, | |
| }, | |
| } | |
| states.AbeWalking.Conditions[3] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 11, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeWalkToStandMidGrid', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = false, | |
| }, | |
| } | |
| states.AbeWalking.Conditions[4] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 2, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeWalkToStand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| WalkOtherDirection = true, | |
| }, | |
| } | |
| states.AbeWalking.Conditions[5] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 11, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeWalkToStandMidGrid', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| WalkOtherDirection = true, | |
| }, | |
| } | |
| states.AbeStandTurnAround = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = true, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandTurnAround.Sounds = {} | |
| states.AbeStandTurnAround.Sounds[1] = { | |
| 'GRAVEL_SMALL', | |
| } | |
| states.AbeStandTurnAround.Conditions = {} | |
| states.AbeStandTurnAround.Conditions[0] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 4, | |
| }, | |
| FlipX = true, | |
| TargetAnimation ='AbeStandTurnAroundToRunning', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| RunOtherDirection = true, | |
| }, | |
| } | |
| states.AbeStandIdle = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = true, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandIdle.Conditions = {} | |
| states.AbeStandIdle.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToCrouch', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| SitDown = true, | |
| }, | |
| } | |
| states.AbeStandIdle.Conditions[1] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToWalk', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = true, | |
| WalkOtherDirection = false, | |
| }, | |
| } | |
| states.AbeStandIdle.Conditions[2] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToRun', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Running = true, | |
| RunOtherDirection = false, | |
| }, | |
| } | |
| states.AbeStandIdle.Conditions[3] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandTurnAround', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| WalkOtherDirection = true, | |
| }, | |
| } | |
| states.AbeStandIdle.Conditions[4] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandTurnAround', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| RunOtherDirection = true, | |
| }, | |
| } | |
| states.AbeStandIdle.Conditions[5] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToHop', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Hopping = true, | |
| }, | |
| } | |
| states.AbeStandIdle.Conditions[6] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToJump', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| StandUp = true, | |
| }, | |
| } | |
| states.AbeWalkToStandMidGrid = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = true, | |
| UseVelocityX = false, | |
| XSpeed=2.777771, | |
| YSpeed=0 | |
| } | |
| states.AbeWalkToStandMidGrid.Sounds = {} | |
| states.AbeWalkToStandMidGrid.Sounds[2] = { | |
| 'FOOTSTEP', | |
| } | |
| states.AbeWalkToStandMidGrid.Conditions = {} | |
| states.AbeWalkToStandMidGrid.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToFallingFromTrapDoor', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = false, | |
| }, | |
| } | |
| states.AbeWalkToStand = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = true, | |
| UseVelocityX = false, | |
| XSpeed=2.777771, | |
| YSpeed=0 | |
| } | |
| states.AbeStandTurnAroundToRunning = { | |
| NextAnimation ='AbeRunning', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeRunning = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRunning.Sounds = {} | |
| states.AbeRunning.Sounds[4] = { | |
| 'FOOTSTEP_RUN', | |
| } | |
| states.AbeRunning.Sounds[12] = { | |
| 'FOOTSTEP_RUN', | |
| } | |
| states.AbeRunning.Conditions = {} | |
| states.AbeRunning.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningOffEdge', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = false, | |
| }, | |
| } | |
| states.AbeRunning.Conditions[1] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 4, | |
| 12, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningToSkidTurn', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| RunOtherDirection = true, | |
| }, | |
| } | |
| states.AbeRunning.Conditions[2] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 4, | |
| 12, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningToSkidTurn', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| WalkOtherDirection = true, | |
| }, | |
| } | |
| states.AbeRunning.Conditions[3] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 12, | |
| 4, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningSkidStop', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = false, | |
| Running = false, | |
| }, | |
| } | |
| states.AbeRunning.Conditions[4] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 12, | |
| 4, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningToWalkingMidGrid', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = true, | |
| WalkOtherDirection = false, | |
| }, | |
| } | |
| states.AbeRunning.Conditions[5] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 12, | |
| 4, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningToRoll', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| SitDown = true, | |
| }, | |
| } | |
| states.AbeRunning.Conditions[6] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 12, | |
| 4, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeRuningToJump', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Hopping = true, | |
| }, | |
| } | |
| states.AbeRunningSkidStop = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = true, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningSkidStop.Sounds = {} | |
| states.AbeRunningSkidStop.Sounds[0] = { | |
| 'GRAVEL_LOUD', | |
| } | |
| states.AbeRunningSkidStop.Sounds[15] = { | |
| 'FOOTSTEP', | |
| } | |
| states.AbeStandToRun = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeStandToRun.Conditions = {} | |
| states.AbeStandToRun.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunningOffEdge', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = false, | |
| }, | |
| } | |
| states.AbeStandToRun.Conditions[1] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunning', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = true, | |
| }, | |
| } | |
| states.AbeRunningToSkidTurn = { | |
| NextAnimation ='AbeRunningTurnAroundToWalk', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = true, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningToSkidTurn.Sounds = {} | |
| states.AbeRunningToSkidTurn.Sounds[3] = { | |
| 'GRAVEL_LOUD', | |
| } | |
| states.AbeRunningToSkidTurn.Conditions = {} | |
| states.AbeRunningToSkidTurn.Conditions[0] = { | |
| AnyTime = false, | |
| FlipX = true, | |
| TargetAnimation ='AbeRunning', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Running = true, | |
| }, | |
| } | |
| states.AbeRunningTurnAroundToWalk = { | |
| NextAnimation ='AbeWalking', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = true, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandToHop = { | |
| NextAnimation ='AbeHopping', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandToHop.Conditions = {} | |
| states.AbeStandToHop.Conditions[0] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 9, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeHopping', | |
| TargetAnimationFrameIndex=10, | |
| } | |
| states.AbeHopping = { | |
| NextAnimation ='AbeHoppingToStand', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=14, | |
| YSpeed=0 | |
| } | |
| states.AbeHoppingToStand = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = true, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHoppingToStand.Sounds = {} | |
| states.AbeHoppingToStand.Sounds[1] = { | |
| 'HOP', | |
| } | |
| states.AbeHoppingToStand.Conditions = {} | |
| states.AbeHoppingToStand.Conditions[0] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 3, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToHop', | |
| TargetAnimationFrameIndex=6, | |
| Conditions = { | |
| Hopping = true, | |
| }, | |
| } | |
| states.AbeStandToCrouch = { | |
| NextAnimation ='AbeCrouchIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeCrouchIdle = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = true, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeCrouchIdle.Conditions = {} | |
| states.AbeCrouchIdle.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchTurnAround', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| WalkOtherDirection = true, | |
| }, | |
| } | |
| states.AbeCrouchIdle.Conditions[1] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchTurnAround', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| RunOtherDirection = true, | |
| }, | |
| } | |
| states.AbeCrouchIdle.Conditions[2] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchToStand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| StandUp = true, | |
| }, | |
| } | |
| states.AbeCrouchIdle.Conditions[3] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchToRoll', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Running = true, | |
| }, | |
| } | |
| states.AbeCrouchIdle.Conditions[4] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchToRoll', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = true, | |
| }, | |
| } | |
| states.AbeCrouchToRoll = { | |
| NextAnimation ='AbeRolling', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRolling = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRolling.Sounds = {} | |
| states.AbeRolling.Sounds[0] = { | |
| 'ROLL', | |
| } | |
| states.AbeRolling.Sounds[6] = { | |
| 'ROLL', | |
| } | |
| states.AbeRolling.Conditions = {} | |
| states.AbeRolling.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeRollingToFalling', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = false, | |
| }, | |
| } | |
| states.AbeRolling.Conditions[1] = { | |
| AnyTime = false, | |
| FlipX = false, | |
| TargetAnimation ='AbeStandToRun', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Running = true, | |
| RunOtherDirection = false, | |
| }, | |
| } | |
| states.AbeRolling.Conditions[2] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 1, | |
| 5, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchIdle', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Walking = false, | |
| Running = false, | |
| }, | |
| } | |
| states.AbeRolling.Conditions[3] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 1, | |
| 5, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchIdle', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| WalkOtherDirection = true, | |
| }, | |
| } | |
| states.AbeRolling.Conditions[4] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 1, | |
| 5, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeCrouchIdle', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| RunOtherDirection = true, | |
| }, | |
| } | |
| states.AbeCrouchToStand = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeCrouchTurnAround = { | |
| NextAnimation ='AbeCrouchIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = true, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeWalkingToRunningMidGrid = { | |
| NextAnimation ='AbeRunning', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningToWalkingMidGrid = { | |
| NextAnimation ='AbeWalking', | |
| NextAnimationFrameIndex = 9, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=2.777771, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningToRoll = { | |
| NextAnimation ='AbeRolling', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRuningToJump = { | |
| NextAnimation ='AbeRunningJumpInAir', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningJumpInAir = { | |
| NextAnimation ='AbeFreeFallToLand', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=7.599991, | |
| YSpeed=9.599991 | |
| } | |
| states.AbeRunningJumpInAir.Conditions = {} | |
| states.AbeRunningJumpInAir.Conditions[0] = { | |
| AnyTime = false, | |
| AtFrames = { | |
| 7, | |
| 8, | |
| 9, | |
| 10, | |
| }, | |
| FlipX = false, | |
| TargetAnimation ='AbeFallingToLand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = true, | |
| }, | |
| } | |
| states.AbeFallingToLand = { | |
| NextAnimation ='AbeRunningSkidStop', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0.355469, | |
| YSpeed=0 | |
| } | |
| states.AbeFallingToLand.Sounds = {} | |
| states.AbeFallingToLand.Sounds[0] = { | |
| 'HOP', | |
| } | |
| states.AbeFallingToLand.Conditions = {} | |
| states.AbeFallingToLand.Conditions[0] = { | |
| AnyTime = false, | |
| FlipX = false, | |
| TargetAnimation ='AbeRunning', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| Running = true, | |
| }, | |
| } | |
| states.AbeFallBackStanding = { | |
| NextAnimation ='AbeCrouchFallBack', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = true, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeFallBackStanding.Sounds = {} | |
| states.AbeFallBackStanding.Sounds[0] = { | |
| 'KNOCKBACK', | |
| 'VOICE_HURT', | |
| } | |
| states.AbeFallBackStanding.Sounds[7] = { | |
| 'KNOCKBACK', | |
| } | |
| states.AbeCrouchFallBack = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandToJump = { | |
| NextAnimation ='AbeJumpUpFalling', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHitGroundToStand = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHitGroundToStand.Sounds = {} | |
| states.AbeHitGroundToStand.Sounds[0] = { | |
| 'HOP', | |
| } | |
| states.AbeJumpUpFalling = { | |
| NextAnimation ='AbeJumpUpFalling', | |
| NextAnimationFrameIndex = 6, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeJumpUpFalling.Conditions = {} | |
| states.AbeJumpUpFalling.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeHitGroundToStand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = true, | |
| }, | |
| } | |
| states.AbeHoistDangling = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHoistDangling.Conditions = {} | |
| states.AbeHoistDangling.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeHoistPullSelfUp', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| StandUp = true, | |
| }, | |
| } | |
| states.AbeHoistPullSelfUp = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHoistPullSelfUp.Sounds = {} | |
| states.AbeHoistPullSelfUp.Sounds[2] = { | |
| 'VOICE_GRUNT', | |
| } | |
| states.AbeStandPushWall = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeFreeFallToLand = { | |
| NextAnimation ='AbeFreeFallToLand', | |
| NextAnimationFrameIndex = 1, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = true, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeFreeFallToLand.Conditions = {} | |
| states.AbeFreeFallToLand.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeHitGroundToStand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = true, | |
| }, | |
| } | |
| states.AbeHoistSwinging = { | |
| NextAnimation ='AbeHoistDangling', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHoistSwinging.Sounds = {} | |
| states.AbeHoistSwinging.Sounds[0] = { | |
| 'VOICE_EDGE_RUN_GRAB', | |
| } | |
| states.AbeHoistSwinging.Conditions = {} | |
| states.AbeHoistSwinging.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeHoistPullSelfUp', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| StandUp = true, | |
| }, | |
| } | |
| states.AbeStandToChant = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeChantToStand = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandSpeak2 = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandingSpeak4 = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeStandToFallingFromTrapDoor = { | |
| NextAnimation ='AbeFreeFallToLand', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = true, | |
| XSpeed=2.777771, | |
| YSpeed=0 | |
| } | |
| states.AbeHitGroundToStand = { | |
| NextAnimation ='AbeStandIdle', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeHitGroundToStand.Sounds = {} | |
| states.AbeHitGroundToStand.Sounds[0] = { | |
| 'HOP', | |
| 'VOICE_LANDING', | |
| } | |
| states.AbeRollingToFalling = { | |
| NextAnimation ='AbeFreeFallToLand', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = false, | |
| XSpeed=0, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningOffEdge = { | |
| NextAnimation ='', | |
| NextAnimationFrameIndex = 0, | |
| FlipX = false, | |
| SnapToGrid = false, | |
| UseVelocityX = true, | |
| XSpeed=6.25, | |
| YSpeed=0 | |
| } | |
| states.AbeRunningOffEdge.Conditions = {} | |
| states.AbeRunningOffEdge.Conditions[0] = { | |
| AnyTime = true, | |
| FlipX = false, | |
| TargetAnimation ='AbeHitGroundToStand', | |
| TargetAnimationFrameIndex=0, | |
| Conditions = { | |
| OnGround = true, | |
| }, | |
| } | |
| -- END STATE DATA | |
| states.Active = states.AbeStandIdle | |
| states.velX = 0 | |
| self.states = states | |
| print(type(self.states.Active)) | |
| end | |
| local function condition_is(self, c, i) | |
| if c == "Walking" then | |
| return not i:InputRun() and (i:InputLeft() or i:InputRight()) | |
| elseif c == "Running" then | |
| return i:InputRun() and (i:InputLeft() or i:InputRight()) | |
| elseif c == "Hopping" then | |
| return i:InputJump() | |
| elseif c == "WalkOtherDirection" then | |
| if (i:InputRight() and self:FacingLeft() and not i:InputRun()) or (i:InputLeft() and not self:FacingLeft() and not i:InputRun()) then return true else return false end | |
| elseif c == "RunOtherDirection" then | |
| if (i:InputRight() and self:FacingLeft() and i:InputRun()) or (i:InputLeft() and not self:FacingLeft() and i:InputRun()) then return true else return false end | |
| elseif c == "SitDown" then | |
| return i:InputDown() | |
| elseif c == "StandUp" then | |
| return i:InputUp() | |
| elseif c == "OnGround" then | |
| return true | |
| elseif c == "UsingTool" then | |
| return false | |
| elseif c == "CanUseTool" then | |
| return false | |
| elseif c == "Chant" then | |
| return i:InputChant() | |
| elseif c == "Special1" then | |
| return false | |
| elseif c == "Special2" then | |
| return false | |
| elseif c == "Special3" then | |
| return false | |
| elseif c == "Special4" then | |
| return false | |
| elseif c == "Special5" then | |
| return false | |
| else | |
| print("unknown condition " .. c) | |
| return false | |
| end | |
| end | |
| -- TODO: Call only when frame changed! | |
| function tick_fsm(self, input) | |
| local states = self.states | |
| local frameNum = self:FrameNumber() | |
| if states.Active.Sounds ~= nil then | |
| if states.Active.Sounds[frameNum] ~= nil then | |
| -- TODO: Fix me - some how ends up being nil here despite above check!? | |
| --print("SFX " .. states.Active.Sounds[frameNum]) | |
| --PlaySoundEffect(states.Active.Sounds[frameNum]) | |
| end | |
| end | |
| if states.Active.UseVelocityX then | |
| if frameNum == 0 and states.Active.XSpeed == 0 then | |
| if self:FacingLeft() then | |
| states.velX = -states.Active.XSpeed | |
| else | |
| states.velX = states.Active.XSpeed | |
| end | |
| end | |
| if (states.velX > 0) then | |
| states.velX = states.velX - 0.375 | |
| else | |
| states.velX = states.velX + 0.375 | |
| end | |
| else | |
| if self:FacingLeft() then | |
| states.velX = -states.Active.XSpeed | |
| else | |
| states.velX = states.Active.XSpeed | |
| end | |
| end | |
| self.mXPos = self.mXPos + states.velX | |
| local animationAtEnd = self:IsLastFrame() | |
| local stateFound = false | |
| if animationAtEnd then | |
| stateFound = true | |
| end | |
| local nextAnimation = states.Active.NextAnimation | |
| local flipX = states.Active.FlipX | |
| local startFrame = states.Active.NextAnimationFrameIndex | |
| if states.Active.Conditions ~= nil then | |
| for i = 0, #states.Active.Conditions do | |
| local isGood = true | |
| local condition = states.Active.Conditions[i] | |
| local skipConds = false | |
| if animationAtEnd == false and condition.AnyTime == false then | |
| if condition.AtFrames == nil then | |
| skipConds = true | |
| elseif condition.AtFrames[frameNum-1] == nil then | |
| skipConds = true | |
| end | |
| end | |
| if skipConds == false then | |
| --print("Check conds") | |
| if condition.Conditions ~= nil then | |
| for c, v in pairs(condition.Conditions) do | |
| if condition_is(self, c, input) ~= v then | |
| isGood = false | |
| if v then | |
| --print("Condition failed, expected " .. c .. "to be true but was false") | |
| else | |
| --print("Condition failed, expected " .. c .. "to be false but was true") | |
| end | |
| break | |
| end | |
| end | |
| end | |
| if isGood then | |
| print("Got state change") | |
| nextAnimation = condition.TargetAnimation | |
| flipX = condition.FlipX | |
| startFrame = condition.TargetAnimationFrameIndex | |
| stateFound = true | |
| if nextAnimation == nil or nextAnimation == '' then | |
| print("Error, next state not set") | |
| end | |
| end | |
| end | |
| end | |
| end | |
| if stateFound and nextAnimation ~= nil and nextAnimation ~= '' then | |
| if flipX then | |
| self:FlipXDirection() | |
| end | |
| print("Set next state to " .. nextAnimation) | |
| states.Active = states[nextAnimation] | |
| print(type(states.Active)) | |
| self:SetAnimation(nextAnimation, startFrame) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment