@@ -23,6 +23,13 @@ yarnScript = ExtResource( 3 ) | |||||
[node name="CanvasLayer" type="CanvasLayer" parent="."] | [node name="CanvasLayer" type="CanvasLayer" parent="."] | ||||
[node name="HUD" parent="CanvasLayer" instance=ExtResource( 7 )] | |||||
[node name="UI" type="Control" parent="CanvasLayer"] | |||||
anchor_right = 1.0 | |||||
anchor_bottom = 1.0 | |||||
__meta__ = { | |||||
"_edit_use_anchors_": false | |||||
} | |||||
[node name="HUD" parent="CanvasLayer/UI" instance=ExtResource( 7 )] | |||||
[node name="SpeechPanel" parent="CanvasLayer" instance=ExtResource( 6 )] | |||||
[node name="SpeechPanel" parent="CanvasLayer/UI" instance=ExtResource( 6 )] |
@@ -8,6 +8,9 @@ export var yarnScript : Resource | |||||
var yarnRunner := YarnRunner.new() | var yarnRunner := YarnRunner.new() | ||||
func _ready(): | |||||
yarnRunner.add_command("SpawnCoins", funcref($"../../../Coins", "spawn_coins")) | |||||
func on_interact(): | func on_interact(): | ||||
if not is_talking: | if not is_talking: | ||||
yarnRunner.say_func = funcref(Controller.speech_panel.text, "on_new_line") | yarnRunner.say_func = funcref(Controller.speech_panel.text, "on_new_line") | ||||
@@ -1,5 +1,7 @@ | |||||
extends Area | extends Area | ||||
signal picked_up | |||||
export var goldToGive : int = 1 | export var goldToGive : int = 1 | ||||
var rotateSpeed : float = 5.0 | var rotateSpeed : float = 5.0 | ||||
@@ -13,4 +15,5 @@ func _on_Pickup_body_entered(body): | |||||
# is this the player? If so give them gold | # is this the player? If so give them gold | ||||
if body.name == "Player": | if body.name == "Player": | ||||
body.give_gold(goldToGive) | body.give_gold(goldToGive) | ||||
emit_signal("picked_up") | |||||
queue_free() | queue_free() |
@@ -2,6 +2,8 @@ extends Node | |||||
class_name BaseLevel | class_name BaseLevel | ||||
signal end | |||||
func _enter_tree(): | func _enter_tree(): | ||||
Controller.player_input_enabled = true | Controller.player_input_enabled = true | ||||
@@ -0,0 +1,15 @@ | |||||
extends Node | |||||
var prout := false | |||||
func _ready(): | |||||
$YarnRunnerNode.yarnRunner.add_command("Spawn", funcref(self, "spawn")) | |||||
func _on_TriggerArea_body_entered(body): | |||||
if not prout: | |||||
$YarnRunnerNode.start_script() | |||||
prout = true | |||||
func spawn(entity): | |||||
yield(get_tree(), "idle_frame") | |||||
$"../Enemy Spawner".spawn($"../Enemy Spawner".character_data) |
@@ -1,8 +1,13 @@ | |||||
extends Node | extends Node | ||||
export var character_data : Resource | export var character_data : Resource | ||||
export var spawn_on_ready := false | |||||
func _ready(): | func _ready(): | ||||
if spawn_on_ready: | |||||
spawn(character_data) | |||||
func spawn(entity): | |||||
var inst = character_data.scene.instance() | var inst = character_data.scene.instance() | ||||
inst.name = character_data.name | inst.name = character_data.name | ||||
if character_data.yarn != null: | if character_data.yarn != null: | ||||
@@ -0,0 +1,31 @@ | |||||
extends Node | |||||
signal all_coins_picked_up | |||||
export var coin_scene : PackedScene | |||||
var prout := false | |||||
export var spawn_on_ready := false | |||||
var coins := -1 | |||||
func _ready(): | |||||
if spawn_on_ready: | |||||
spawn_coins(null) | |||||
func spawn_coins(args): | |||||
yield(get_tree(), "idle_frame") | |||||
if not prout: | |||||
coins = 0 | |||||
for spawn in get_children(): | |||||
var coin = coin_scene.instance() | |||||
coin.connect("picked_up", self, "on_coin_picked_up") | |||||
coins += 1 | |||||
spawn.add_child(coin) | |||||
prout = true | |||||
func on_coin_picked_up(): | |||||
coins -= 1 | |||||
if coins == 0: | |||||
emit_signal("all_coins_picked_up") |
@@ -1,3 +1,6 @@ | |||||
extends BaseLevel | extends BaseLevel | ||||
class_name TestLevel | class_name TestLevel | ||||
func _on_Coins_all_coins_picked_up(): | |||||
emit_signal("end") |
@@ -17,11 +17,19 @@ func load_scene(args): | |||||
for child in $SceneContainer.get_children(): | for child in $SceneContainer.get_children(): | ||||
child.queue_free() | child.queue_free() | ||||
var scene = scenes[scene_key].instance() | var scene = scenes[scene_key].instance() | ||||
scene.connect("end", self, "on_scene_end") | |||||
$SceneContainer.add_child(scene) | $SceneContainer.add_child(scene) | ||||
if scene_key == "TestGameOver": | |||||
$CanvasLayer/UI.hide() | |||||
else: | |||||
$CanvasLayer/UI.show() | |||||
func wait_signal(args): | func wait_signal(args): | ||||
yield(self, "end") | yield(self, "end") | ||||
func on_scene_end(): | |||||
emit_signal("end") | |||||
func _input(event): | func _input(event): | ||||
if event.is_action_pressed("ui_cancel"): | if event.is_action_pressed("ui_cancel"): | ||||
emit_signal("end") | emit_signal("end") |
@@ -0,0 +1,9 @@ | |||||
title: Start | |||||
tags: | |||||
colorID: 0 | |||||
position: 693,546 | |||||
--- | |||||
Un personnage apparaît ! | |||||
<<Spawn enemy_base>> | |||||
Un personnage est apparu ! | |||||
=== |
@@ -1,5 +1,6 @@ | |||||
title: Start | title: Start | ||||
tags: | tags: | ||||
colorID: 0 | |||||
position: 701,320 | position: 701,320 | ||||
--- | --- | ||||
Bonjour je suis un npc de debug ! | Bonjour je suis un npc de debug ! | ||||
@@ -8,19 +9,19 @@ Bonjour je suis un npc de debug ! | |||||
=== | === | ||||
title: bonjour | title: bonjour | ||||
tags: | tags: | ||||
position: 1032.2125854492188,730.3896484375 | |||||
colorID: 0 | |||||
position: 1032,730 | |||||
--- | --- | ||||
Est-ce que tu aimes la France ? | Est-ce que tu aimes la France ? | ||||
Est-ce que tu es prêt à donner ta vie pour la France ?? | Est-ce que tu es prêt à donner ta vie pour la France ?? | ||||
A MOURIIIR POUR TA PATRIE ?? | A MOURIIIR POUR TA PATRIE ?? | ||||
<<SpawnCoins>> | |||||
Alors ramasse les piépièces ! | |||||
=== | === | ||||
title: ntm | title: ntm | ||||
tags: | tags: | ||||
position: 693.5343566489377,684.1047771502635 | |||||
colorID: 0 | |||||
position: 693,684 | |||||
--- | --- | ||||
Vous n'avez pas honte ?? | Vous n'avez pas honte ?? | ||||
=== | === | ||||