forked from team-sg/hero-mark-2
fix debug mouse thingy (fixes #13)
This commit is contained in:
parent
ba66c8a6f7
commit
940583c7aa
1 changed files with 11 additions and 2 deletions
|
@ -41,8 +41,17 @@ func _physics_process(delta):
|
||||||
console.visible = !console.visible
|
console.visible = !console.visible
|
||||||
#Move player to mouse
|
#Move player to mouse
|
||||||
if Input.is_action_pressed("debug_move_player"):
|
if Input.is_action_pressed("debug_move_player"):
|
||||||
Game.get_map().get_node("Player").position = get_viewport().get_mouse_position()
|
var nodes = get_tree().get_nodes_in_group("player")
|
||||||
Debug.print(get_viewport().get_mouse_position())
|
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
|
#Test room
|
||||||
if Input.is_action_just_pressed("debug_testroom"):
|
if Input.is_action_just_pressed("debug_testroom"):
|
||||||
Game.change_map(load("res://maps/test_room.tscn"))
|
Game.change_map(load("res://maps/test_room.tscn"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue