onilink_

Untitled

May 25th, 2021 (edited)
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. 0 animate 0.12 1
  2. 1 expr self.on_ground 3 2
  3. 2 state JumpAir
  4. 3 check Space 7 4
  5. 4 check MouseLeft 8 5
  6. 5 expr Monster.checkMovementInput(self) 9 6
  7. 6 expr self.inputs:check(InputKey.Action1) and entity:onDiggableGround() 11 4294967295
  8. 7 state JumpStart
  9. 8 check Down 12 11
  10. 9 state Move
  11. 10 state Dig
  12. 11 state Attack
  13. 12 state Attack2
  14.  
  15. if(self.state == State.Idle) then
  16.   self.frame = self.frame + 0.12 * dt
  17.   if(self.on_ground) then
  18.     if(self.inputs:check(InputKey.Space)) then
  19.       self:setState(entity, State.JumpStart)
  20.     else
  21.       if(self.inputs:check(InputKey.MouseLeft)) then
  22.         if(self.inputs:check(InputKey.Down)) then
  23.           self:setState(entity, State.Attack2)
  24.         else
  25.           self:setState(entity, State.Attack)
  26.         end
  27.       else
  28.         if(Monster.checkMovementInput(self)) then
  29.           self:setState(entity, State.Move)
  30.         else
  31.           if(self.inputs:check(InputKey.Action1) and entity:onDiggableGround()) then
  32.             self:setState(entity, State.Attack)
  33.           end
  34.         end
  35.       end
  36.     end
  37.   else
  38.     self:setState(entity, State.JumpAir)
  39.   end
  40. end
Add Comment
Please, Sign In to add comment