33 lines
582 B
GDScript3
33 lines
582 B
GDScript3
|
extends State
|
||
|
func enter_state(n):
|
||
|
pass
|
||
|
func update_state(delta):
|
||
|
pass
|
||
|
func update_state_phy(delta):
|
||
|
if get_player().is_move_finished():
|
||
|
|
||
|
change_to_state("idle")
|
||
|
print("切换为idle")
|
||
|
return
|
||
|
|
||
|
match get_player().get_dir():
|
||
|
0:
|
||
|
get_player().play_animation("up")
|
||
|
1:
|
||
|
get_player().play_animation("down")
|
||
|
2:
|
||
|
get_player().play_animation("left_right")
|
||
|
3:
|
||
|
get_player().play_animation("left_right")
|
||
|
pass
|
||
|
func exit_state():
|
||
|
pass
|
||
|
|
||
|
func process_message(type:String,n):
|
||
|
match type:
|
||
|
"move":
|
||
|
get_player().set_target_pos(n)
|
||
|
change_to_state("run")
|
||
|
|
||
|
pass
|