forked from team-sg/hero-mark-2
made restart key gover the player
This commit is contained in:
parent
b65dbd834b
commit
db3ac62f27
4 changed files with 19 additions and 23 deletions
23
game.gd
23
game.gd
|
@ -58,7 +58,7 @@ func get_sector(pos):
|
|||
|
||||
#Return the current Map
|
||||
func get_map():
|
||||
return viewport.get_children()[0]
|
||||
return get_tree().get_nodes_in_group("map")[0]
|
||||
|
||||
#Go to new map
|
||||
func change_map(map):
|
||||
|
@ -107,13 +107,14 @@ func timeify(input):
|
|||
return "9:59:99"
|
||||
|
||||
func _process(delta):
|
||||
#CRT FILTER
|
||||
if Input.is_action_just_pressed("crt"):
|
||||
viewport_container.material.set_shader_param("enabled",!viewport_container.material.get_shader_param("enabled"))
|
||||
#Fullscreen
|
||||
if Input.is_action_just_pressed("fullscreen"):
|
||||
fullscreen = !fullscreen
|
||||
if fullscreen:
|
||||
OS.set_window_fullscreen(true)
|
||||
else:
|
||||
OS.set_window_fullscreen(false)
|
||||
if Debug.entry == false:
|
||||
#CRT FILTER
|
||||
if Input.is_action_just_pressed("crt"):
|
||||
viewport_container.material.set_shader_param("enabled",!viewport_container.material.get_shader_param("enabled"))
|
||||
#Fullscreen
|
||||
if Input.is_action_just_pressed("fullscreen"):
|
||||
fullscreen = !fullscreen
|
||||
if fullscreen:
|
||||
OS.set_window_fullscreen(true)
|
||||
else:
|
||||
OS.set_window_fullscreen(false)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[ext_resource path="res://objects/collectibles/gold.tscn" type="PackedScene" id=14]
|
||||
[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 )
|
||||
music = ExtResource( 12 )
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 8, 128 )
|
||||
|
||||
[node name="Map" type="Node2D"]
|
||||
[node name="Map" type="Node2D" groups=["map"]]
|
||||
script = ExtResource( 18 )
|
||||
target_time_any = 70
|
||||
target_time_100 = 180
|
||||
|
|
|
@ -40,15 +40,8 @@ func _physics_process(delta):
|
|||
console.visible = !console.visible
|
||||
#Restart scene
|
||||
if Input.is_action_just_pressed("debug_restart"):
|
||||
if Game.score > Game.high_score: Game.high_score = Game.score
|
||||
Game.score = 0
|
||||
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()
|
||||
Game.lives = -1
|
||||
Game.get_map().get_node("Player").die()
|
||||
#Move player to mouse
|
||||
if Input.is_action_pressed("debug_move_player"):
|
||||
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"))
|
||||
#Debug 2
|
||||
if Input.is_action_just_pressed("debug_2"):
|
||||
Engine.set_target_fps(1)
|
||||
Debug.print(Game.get_map())
|
||||
|
||||
func print(text):
|
||||
lines += 1
|
||||
|
@ -115,3 +108,5 @@ func _enter_code():
|
|||
Game.play_sound(Game.a_die, Game.ac_die)
|
||||
for enemy in get_tree().get_nodes_in_group("enemy"):
|
||||
enemy.queue_free()
|
||||
"DGSTEEZY":
|
||||
debug = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue