Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- var PLAYERSTATE_PREV = ""
- var PLAYERSTATE = ""
- var PLAYERSTATE_NEXT = "ground"
- var x = 20
- func _ready():
- set_process(true)
- pass
- func _process(delta):
- PLAYERSTATE_PREV = PLAYERSTATE
- PLAYERSTATE = PLAYERSTATE_NEXT
- if PLAYERSTATE == "ground":
- print(PLAYERSTATE)
- ground_state(delta)
- elif PLAYERSTATE =="air":
- air_state(delta)
- func ground_state(delta):
- x -= 1
- print(x)
- if x < 10:
- PLAYERSTATE_NEXT = "air"
- x = 20
- func air_state(delta):
- x = x - 1
- print(x)
- print("air!")
- if x < 1:
- PLAYERSTATE_NEXT = "ground"
- x = 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement