Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | potatobanana |
hello everyone, can some tell me how to make my object position stay in red circle at start game? because every time i start game my object position at 0,0
this my player scene script
func _process(delta: float) -> void:
global_position = lerp(global_position,get_viewport().get_mouse_position(),0.2)
i try do something like this,
var can_move_mouse = false
func _ready() -> void:
global_position = Vector2(145,475)
func _process(delta: float) -> void:
if can_move_mouse == true:
global_position = lerp(global_position,get_viewport().get_mouse_position(),0.2)
func _on_Timer_timeout() -> void:
can_move_mouse = true
here i record the problem
but when time out and mouse not inside screen, my position go back to 0,0. i want it stay at it position if mouse not in screen
Please show all the code about this issue.
ATom 1 | 2020-01-09 09:59
Because when you run the game, the mouse has not entered the window, so get_mouse_position () will return 0,0.
ATom 1 | 2020-01-09 11:52
Yes, I realized that the reason is very simple, please hide these wrong ideas and prevent the wrong guidance of users with other similar problems
ATom 1 | 2020-01-09 12:14