challenge-editor/scene/card_state_machine/selected.gd
2024-09-25 11:52:36 +08:00

37 lines
872 B
GDScript

extends State
var init_position:Vector2=Vector2.ZERO
var target_y:float=200
var need_target:bool=false
func enter_state(n):
get_player().up()
need_target=get_player().need_target()
init_position=get_player().position
if n is Vector2:
init_position=n
pass
func update_state(delta):
get_player().position=get_player().get_parent().get_local_mouse_position()
if Input.is_action_just_released("mouse_left"):
change_to_state("selected_back")
return
if Input.is_action_just_pressed("mouse_right"):
change_to_state("selected_back")
return
var change_y=(init_position-get_player().get_parent().get_local_mouse_position()).y
if need_target and change_y>target_y:
change_to_state("select_target",init_position)
return
pass
func update_state_phy(delta):
pass
func exit_state():
pass
func time_out():
pass
func process_message(type:String,n):
pass