fix debug mouse thingy (fixes #13)

This commit is contained in:
Haze Weathers 2023-03-22 13:09:37 -04:00
parent ba66c8a6f7
commit 940583c7aa

View file

@ -41,8 +41,17 @@ func _physics_process(delta):
console.visible = !console.visible
#Move player to mouse
if Input.is_action_pressed("debug_move_player"):
Game.get_map().get_node("Player").position = get_viewport().get_mouse_position()
Debug.print(get_viewport().get_mouse_position())
var nodes = get_tree().get_nodes_in_group("player")
if not nodes.empty():
var player = nodes[0].get_parent()
var mouse_position = Game.viewport.get_mouse_position() / Game.viewport_container.rect_scale
mouse_position.x = clamp(mouse_position.x, 8.0, Game.resolution.x - 8.0)
mouse_position.y = clamp(mouse_position.y, 8.0, Game.resolution.y - 8.0)
var world_position = mouse_position + Game.current_sector * Game.resolution
player.position = world_position
# Game.get_map().get_node("Player").position = get_viewport().get_mouse_position()
# Debug.print(get_viewport().get_mouse_position())
#Test room
if Input.is_action_just_pressed("debug_testroom"):
Game.change_map(load("res://maps/test_room.tscn"))