Tweaks
- trying to get into the game
This commit is contained in:
parent
53b88e5553
commit
40e752c86e
11 changed files with 94 additions and 36 deletions
|
@ -665,7 +665,9 @@ tracks/4/keys = {
|
||||||
"values": [ true ]
|
"values": [ true ]
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody2D"]
|
[node name="Player" type="KinematicBody2D" groups=[
|
||||||
|
"Boostable",
|
||||||
|
]]
|
||||||
collision_mask = 30
|
collision_mask = 30
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@ extends Level
|
||||||
var _Cutscenes = {
|
var _Cutscenes = {
|
||||||
"old_man_intro": "res://src/CutScenes/ChallengeCutscene.tscn"
|
"old_man_intro": "res://src/CutScenes/ChallengeCutscene.tscn"
|
||||||
}
|
}
|
||||||
var _played_old_man_cutscene = false
|
var _played_old_man_cutscene = !GameState.is_first_run
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
print("preGameReady")
|
print("preGameReady")
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ var _fly := true
|
||||||
var _pin_angle := 0
|
var _pin_angle := 0
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
GameState.connect("player_just_died", self,"queue_free")
|
||||||
seed(self.get_instance_id())
|
seed(self.get_instance_id())
|
||||||
var options = range(-30, 30, 5)
|
var options = range(-30, 30, 5)
|
||||||
options.shuffle()
|
options.shuffle()
|
||||||
|
|
|
@ -11,7 +11,8 @@ onready var _ammo = ammo
|
||||||
var Arrow = load("res://src/Hazards/Arrow.tscn")
|
var Arrow = load("res://src/Hazards/Arrow.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
GameState.connect("player_just_died", self,"_on_Player_died")
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if enabled && _can_activate && _did_trigger():
|
if enabled && _can_activate && _did_trigger():
|
||||||
_can_activate = false
|
_can_activate = false
|
||||||
|
@ -60,3 +61,8 @@ func _on_TimeoutTimer_timeout()->void:
|
||||||
_can_activate = true;
|
_can_activate = true;
|
||||||
$AnimationPlayer.play("armed")
|
$AnimationPlayer.play("armed")
|
||||||
_ammo = ammo
|
_ammo = ammo
|
||||||
|
|
||||||
|
func _on_Player_died():
|
||||||
|
$AnimationPlayer.play("idle")
|
||||||
|
_activated = false
|
||||||
|
$TimeoutTimer.start(timeout)
|
|
@ -81,13 +81,13 @@ anims/fire = SubResource( 2 )
|
||||||
anims/idle = SubResource( 3 )
|
anims/idle = SubResource( 3 )
|
||||||
|
|
||||||
[node name="TopRayCast" type="RayCast2D" parent="."]
|
[node name="TopRayCast" type="RayCast2D" parent="."]
|
||||||
position = Vector2( 3, -16 )
|
position = Vector2( 3, -14 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 150, 0 )
|
cast_to = Vector2( 150, 0 )
|
||||||
collision_mask = 9
|
collision_mask = 9
|
||||||
|
|
||||||
[node name="BottomRayCast" type="RayCast2D" parent="."]
|
[node name="BottomRayCast" type="RayCast2D" parent="."]
|
||||||
position = Vector2( 3, 0 )
|
position = Vector2( 3, -2 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 150, 0 )
|
cast_to = Vector2( 150, 0 )
|
||||||
collision_mask = 9
|
collision_mask = 9
|
||||||
|
|
|
@ -2,9 +2,9 @@ extends Node2D
|
||||||
|
|
||||||
export var thrust:float = 250
|
export var thrust:float = 250
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_entered(body: Node) -> void:
|
func _on_Area2D_body_entered(body: Node) -> void:
|
||||||
if body.name == "Player":
|
if body.is_in_group("Boostable"):
|
||||||
body.boost(Vector2(0, -thrust))
|
var boost_direction = Vector2.UP.rotated(rotation).round()
|
||||||
|
body.boost(boost_direction * thrust)
|
||||||
AudioManager.play_sfx(AudioManager.Sfx.SPRING)
|
AudioManager.play_sfx(AudioManager.Sfx.SPRING)
|
||||||
$AnimationPlayer.play("activated")
|
$AnimationPlayer.play("activated")
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
extends Position2D
|
extends Position2D
|
||||||
tool
|
tool
|
||||||
export var node:PackedScene = null
|
export var node:PackedScene = null
|
||||||
onready var player_ref:Player = get_parent().get_node("Player")
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
if not Engine.editor_hint:
|
||||||
|
GameState.connect("player_just_died", self,"_on_Player_died")
|
||||||
_spawn()
|
_spawn()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
if not Engine.editor_hint:
|
if not Engine.editor_hint:
|
||||||
player_ref.disconnect("died", self, "_on_Player_died")
|
|
||||||
despawn()
|
despawn()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_VisibilityNotifier2D_screen_entered() -> void:
|
func _on_VisibilityNotifier2D_screen_entered() -> void:
|
||||||
if not Engine.editor_hint:
|
|
||||||
player_ref.connect("died", self, "_on_Player_died")
|
|
||||||
respawn()
|
respawn()
|
||||||
|
|
||||||
func reset():
|
func reset():
|
||||||
|
@ -38,13 +36,18 @@ func respawn():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _on_Player_died():
|
func _on_Player_died():
|
||||||
yield(get_tree().create_timer(.7), "timeout")
|
print("SPAWN - PLAYER DIED")
|
||||||
despawn()
|
$RespawnTimer.start()
|
||||||
if $VisibilityNotifier2D.is_on_screen():
|
|
||||||
respawn()
|
|
||||||
|
|
||||||
func _spawn():
|
func _spawn():
|
||||||
var inst = node.instance()
|
var inst = node.instance()
|
||||||
inst.name = "node"
|
inst.name = "node"
|
||||||
add_child(inst)
|
add_child(inst)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_RespawnTimer_timeout() -> void:
|
||||||
|
despawn()
|
||||||
|
if $VisibilityNotifier2D.is_on_screen():
|
||||||
|
respawn()
|
||||||
|
|
|
@ -7,4 +7,9 @@ script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
||||||
rect = Rect2( -50, -50, 100, 100 )
|
rect = Rect2( -50, -50, 100, 100 )
|
||||||
|
|
||||||
|
[node name="RespawnTimer" type="Timer" parent="."]
|
||||||
|
wait_time = 0.7
|
||||||
|
one_shot = true
|
||||||
[connection signal="screen_entered" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_entered"]
|
[connection signal="screen_entered" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_entered"]
|
||||||
|
[connection signal="timeout" from="RespawnTimer" to="." method="_on_RespawnTimer_timeout"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
signal scene_changed
|
signal scene_changed
|
||||||
|
signal player_just_died
|
||||||
enum States{
|
enum States{
|
||||||
INTRO,
|
INTRO,
|
||||||
INTRO_CUTSCENE,
|
INTRO_CUTSCENE,
|
||||||
|
@ -25,7 +25,6 @@ var _SCENES := {
|
||||||
States.INTRO_CUTSCENE: "res://src/CutScenes/IntroCutscene.tscn"
|
States.INTRO_CUTSCENE: "res://src/CutScenes/IntroCutscene.tscn"
|
||||||
}
|
}
|
||||||
|
|
||||||
var _player_spawn_point;
|
|
||||||
|
|
||||||
var GAME_TIMEOUT_MIN = 10
|
var GAME_TIMEOUT_MIN = 10
|
||||||
|
|
||||||
|
@ -140,10 +139,10 @@ func _change_scene(state:int,duration:float=1):
|
||||||
emit_signal("scene_changed")
|
emit_signal("scene_changed")
|
||||||
|
|
||||||
func player_died():
|
func player_died():
|
||||||
|
emit_signal("player_just_died")
|
||||||
_run_data.deaths += 1
|
_run_data.deaths += 1
|
||||||
_data.statistics.deaths += 1
|
_data.statistics.deaths += 1
|
||||||
|
|
||||||
|
|
||||||
func coin_collected():
|
func coin_collected():
|
||||||
_run_data.coins += 10
|
_run_data.coins += 10
|
||||||
_data.statistics.coins += 10
|
_data.statistics.coins += 10
|
||||||
|
|
Loading…
Reference in a new issue