made restart key gover the player

This commit is contained in:
pennyrigate 2023-01-13 02:08:10 -05:00
parent b65dbd834b
commit db3ac62f27
4 changed files with 19 additions and 23 deletions

23
game.gd
View file

@ -58,7 +58,7 @@ func get_sector(pos):
#Return the current Map #Return the current Map
func get_map(): func get_map():
return viewport.get_children()[0] return get_tree().get_nodes_in_group("map")[0]
#Go to new map #Go to new map
func change_map(map): func change_map(map):
@ -107,13 +107,14 @@ func timeify(input):
return "9:59:99" return "9:59:99"
func _process(delta): func _process(delta):
#CRT FILTER if Debug.entry == false:
if Input.is_action_just_pressed("crt"): #CRT FILTER
viewport_container.material.set_shader_param("enabled",!viewport_container.material.get_shader_param("enabled")) if Input.is_action_just_pressed("crt"):
#Fullscreen viewport_container.material.set_shader_param("enabled",!viewport_container.material.get_shader_param("enabled"))
if Input.is_action_just_pressed("fullscreen"): #Fullscreen
fullscreen = !fullscreen if Input.is_action_just_pressed("fullscreen"):
if fullscreen: fullscreen = !fullscreen
OS.set_window_fullscreen(true) if fullscreen:
else: OS.set_window_fullscreen(true)
OS.set_window_fullscreen(false) else:
OS.set_window_fullscreen(false)

View file

@ -16,7 +16,7 @@
[ext_resource path="res://objects/collectibles/gold.tscn" type="PackedScene" id=14] [ext_resource path="res://objects/collectibles/gold.tscn" type="PackedScene" id=14]
[ext_resource path="res://objects/collectibles/star.tscn" type="PackedScene" id=15] [ext_resource path="res://objects/collectibles/star.tscn" type="PackedScene" id=15]
[node name="Map" type="Node2D"] [node name="Map" type="Node2D" groups=["map"]]
script = ExtResource( 11 ) script = ExtResource( 11 )
music = ExtResource( 12 ) music = ExtResource( 12 )

View file

@ -24,7 +24,7 @@
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 128 ) extents = Vector2( 8, 128 )
[node name="Map" type="Node2D"] [node name="Map" type="Node2D" groups=["map"]]
script = ExtResource( 18 ) script = ExtResource( 18 )
target_time_any = 70 target_time_any = 70
target_time_100 = 180 target_time_100 = 180

View file

@ -40,15 +40,8 @@ func _physics_process(delta):
console.visible = !console.visible console.visible = !console.visible
#Restart scene #Restart scene
if Input.is_action_just_pressed("debug_restart"): if Input.is_action_just_pressed("debug_restart"):
if Game.score > Game.high_score: Game.high_score = Game.score Game.lives = -1
Game.score = 0 Game.get_map().get_node("Player").die()
Game.golds = 0
Game.stars = [false,false,false,false,false]
Game.shards = 0
Game.arrows = 0
Game.lives = 2
Game.ac_climb.stop()
get_tree().reload_current_scene()
#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() Game.get_map().get_node("Player").position = get_viewport().get_mouse_position()
@ -58,7 +51,7 @@ func _physics_process(delta):
Game.change_map(load("res://maps/level_select.tscn")) Game.change_map(load("res://maps/level_select.tscn"))
#Debug 2 #Debug 2
if Input.is_action_just_pressed("debug_2"): if Input.is_action_just_pressed("debug_2"):
Engine.set_target_fps(1) Debug.print(Game.get_map())
func print(text): func print(text):
lines += 1 lines += 1
@ -115,3 +108,5 @@ func _enter_code():
Game.play_sound(Game.a_die, Game.ac_die) Game.play_sound(Game.a_die, Game.ac_die)
for enemy in get_tree().get_nodes_in_group("enemy"): for enemy in get_tree().get_nodes_in_group("enemy"):
enemy.queue_free() enemy.queue_free()
"DGSTEEZY":
debug = true