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 ]
|
||||
}
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
[node name="Player" type="KinematicBody2D" groups=[
|
||||
"Boostable",
|
||||
]]
|
||||
collision_mask = 30
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@ extends Level
|
|||
var _Cutscenes = {
|
||||
"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:
|
||||
print("preGameReady")
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ var _fly := true
|
|||
var _pin_angle := 0
|
||||
|
||||
func _ready() -> void:
|
||||
GameState.connect("player_just_died", self,"queue_free")
|
||||
seed(self.get_instance_id())
|
||||
var options = range(-30, 30, 5)
|
||||
options.shuffle()
|
||||
|
|
|
@ -11,7 +11,8 @@ onready var _ammo = ammo
|
|||
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:
|
||||
if enabled && _can_activate && _did_trigger():
|
||||
_can_activate = false
|
||||
|
@ -60,3 +61,8 @@ func _on_TimeoutTimer_timeout()->void:
|
|||
_can_activate = true;
|
||||
$AnimationPlayer.play("armed")
|
||||
_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 )
|
||||
|
||||
[node name="TopRayCast" type="RayCast2D" parent="."]
|
||||
position = Vector2( 3, -16 )
|
||||
position = Vector2( 3, -14 )
|
||||
enabled = true
|
||||
cast_to = Vector2( 150, 0 )
|
||||
collision_mask = 9
|
||||
|
||||
[node name="BottomRayCast" type="RayCast2D" parent="."]
|
||||
position = Vector2( 3, 0 )
|
||||
position = Vector2( 3, -2 )
|
||||
enabled = true
|
||||
cast_to = Vector2( 150, 0 )
|
||||
collision_mask = 9
|
||||
|
|
|
@ -2,9 +2,9 @@ extends Node2D
|
|||
|
||||
export var thrust:float = 250
|
||||
|
||||
|
||||
func _on_Area2D_body_entered(body: Node) -> void:
|
||||
if body.name == "Player":
|
||||
body.boost(Vector2(0, -thrust))
|
||||
if body.is_in_group("Boostable"):
|
||||
var boost_direction = Vector2.UP.rotated(rotation).round()
|
||||
body.boost(boost_direction * thrust)
|
||||
AudioManager.play_sfx(AudioManager.Sfx.SPRING)
|
||||
$AnimationPlayer.play("activated")
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
extends Position2D
|
||||
tool
|
||||
export var node:PackedScene = null
|
||||
onready var player_ref:Player = get_parent().get_node("Player")
|
||||
|
||||
func _ready() -> void:
|
||||
if not Engine.editor_hint:
|
||||
GameState.connect("player_just_died", self,"_on_Player_died")
|
||||
_spawn()
|
||||
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if not Engine.editor_hint:
|
||||
player_ref.disconnect("died", self, "_on_Player_died")
|
||||
despawn()
|
||||
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_entered() -> void:
|
||||
if not Engine.editor_hint:
|
||||
player_ref.connect("died", self, "_on_Player_died")
|
||||
respawn()
|
||||
|
||||
func reset():
|
||||
|
@ -38,13 +36,18 @@ func respawn():
|
|||
pass
|
||||
|
||||
func _on_Player_died():
|
||||
yield(get_tree().create_timer(.7), "timeout")
|
||||
despawn()
|
||||
if $VisibilityNotifier2D.is_on_screen():
|
||||
respawn()
|
||||
print("SPAWN - PLAYER DIED")
|
||||
$RespawnTimer.start()
|
||||
|
||||
|
||||
func _spawn():
|
||||
var inst = node.instance()
|
||||
inst.name = "node"
|
||||
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="."]
|
||||
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="timeout" from="RespawnTimer" to="." method="_on_RespawnTimer_timeout"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends Node
|
||||
|
||||
signal scene_changed
|
||||
|
||||
signal player_just_died
|
||||
enum States{
|
||||
INTRO,
|
||||
INTRO_CUTSCENE,
|
||||
|
@ -25,7 +25,6 @@ var _SCENES := {
|
|||
States.INTRO_CUTSCENE: "res://src/CutScenes/IntroCutscene.tscn"
|
||||
}
|
||||
|
||||
var _player_spawn_point;
|
||||
|
||||
var GAME_TIMEOUT_MIN = 10
|
||||
|
||||
|
@ -140,10 +139,10 @@ func _change_scene(state:int,duration:float=1):
|
|||
emit_signal("scene_changed")
|
||||
|
||||
func player_died():
|
||||
emit_signal("player_just_died")
|
||||
_run_data.deaths += 1
|
||||
_data.statistics.deaths += 1
|
||||
|
||||
|
||||
func coin_collected():
|
||||
_run_data.coins += 10
|
||||
_data.statistics.coins += 10
|
||||
|
|
Loading…
Reference in a new issue