Advertisement
Voodin

pseudo

Oct 11th, 2022 (edited)
1,780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. node entity
  2. extends kinematicBody2D
  3. #vars
  4. Vector2D position #position in world space
  5.  
  6. #methods
  7. func onHit #activated when a weapon sends hit(),take damage returned by weapon
  8. func onInteract #activated when character sends interact()
  9. func onKill #activated when health = 0, or a kill signal is sent, play death animation and dequeue
  10.  
  11. --------------------------------------
  12. node Character
  13. extends entity
  14.  
  15. #vars
  16. int health
  17. int speed
  18. PlayerController input #this class recieves inputs and hands them to a character
  19. enum physicalState {idle, move, shift, moveandshift} #shift in this case occurs when a certain input is held
  20. enum specialStates {normal, justice, burst} #justice occurs when passing north of the justice line, burst occurs when the burst button is pressed
  21.  
  22.  
  23. #methods
  24. func checkStates(): #checks the current state based on input and current variable vals
  25.     if buttonPressed
  26.         physicalState = move;
  27.     if shootPressed #for x amount of frames.
  28.         physicalState = shift;
  29.     if position - justiceLinePos > 0
  30.         specialState = justice
  31.     #etc...
  32.  
  33. func onShoot #when shoot button is pressed
  34.     if specialState = normal
  35.         #just shoot
  36.     if specialState = justice
  37.         #use justice shot
  38. func onBomb #when bomb button is pressed
  39.  
  40. func onMove(): #when movement buttons are pressed
  41.     if leftPressed #move left anim
  42.     if rightPressed #move right anim
  43.     #etc...
  44.  
  45.  
  46.  
  47. --------------------------------------
  48.  
  49. node Player
  50.  
  51. #methods
  52. func onShoot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement