Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var action
- var direction
- var movement_type
- var movement_speed
- var state
- enum STATE {
- IDLE,
- MOVE,
- FISH
- }
- enum MOVEMENT_TYPE {
- FOOT,
- BIKE,
- SURF,
- SCUBA
- }
- enum MOVEMENT_SPEED {
- NORMAL,
- FAST
- }
- func _process(delta):
- if !isMoving:
- if canMove and !Input.is_action_pressed("z"):
- get_input()
- func get_input():
- if Input.is_action_pressed("ui_down"):
- direction = DIRECTION.DOWN
- elif Input.is_action_pressed("ui_up"):
- direction = DIRECTION.UP
- elif Input.is_action_pressed("ui_left"):
- direction = DIRECTION.LEFT
- elif Input.is_action_pressed("ui_right"):
- direction = DIRECTION.RIGHT
- else:
- break
- state = STATE.MOVE
- if (state == STATE.MOVE) and (movement_type == MOVEMENT_TYPE.FOOT) and (Input.is_action_pressed("run"):
- movement_speed = MOVEMENT_SPEED.FAST
- else:
- movement_speed = MOVEMENT_SPEED.NORMAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement