summaryrefslogtreecommitdiff
path: root/Scenes
diff options
context:
space:
mode:
authorBrenin Cardoso <behilustra@gmail.com>2022-07-16 18:20:07 -0300
committerBrenin Cardoso <behilustra@gmail.com>2022-07-16 18:20:07 -0300
commit749bc692c45ee5db57b4c19f6f3128f2c25b75e1 (patch)
tree75985060895abbb104d34874b192a38b9f9dd775 /Scenes
parentccfcd0aac77b5069360308ad6bab4021425c506b (diff)
parent4cb13729739acf1a4b2e42af51fcea1ed261a1f4 (diff)
downloadgamejam-gmtk-2022-749bc692c45ee5db57b4c19f6f3128f2c25b75e1.tar.gz
gamejam-gmtk-2022-749bc692c45ee5db57b4c19f6f3128f2c25b75e1.tar.bz2
gamejam-gmtk-2022-749bc692c45ee5db57b4c19f6f3128f2c25b75e1.zip
Merge remote-tracking branch 'origin/main'
Diffstat (limited to 'Scenes')
-rw-r--r--Scenes/Dungeon.gd2
-rw-r--r--Scenes/Dungeon.tscn61
-rw-r--r--Scenes/PlateKey.tscn1
-rw-r--r--Scenes/ScoreParticle.gd18
-rw-r--r--Scenes/ScoreParticle.tscn87
-rw-r--r--Scenes/UIController.gd15
6 files changed, 177 insertions, 7 deletions
diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd
index 84d954f..c1ece2f 100644
--- a/Scenes/Dungeon.gd
+++ b/Scenes/Dungeon.gd
@@ -9,6 +9,7 @@ const Crystal = preload("res://Scenes/Crystal.tscn")
onready var camera = $Pitch
onready var player : Entity = null
+onready var ui_controller = $UIController
var input : Vector2
@@ -138,6 +139,7 @@ func process_turn_logic():
monster.add_action("cor_dies", [])
Global.turns += int(player.get_upper_face())
kill_entity(monster)
+ ui_controller.on_monster_killed(monster.translation, player.get_upper_face())
else:
monster.health -= top
monster.add_action("cor_stomp", [])
diff --git a/Scenes/Dungeon.tscn b/Scenes/Dungeon.tscn
index 2126367..727408f 100644
--- a/Scenes/Dungeon.tscn
+++ b/Scenes/Dungeon.tscn
@@ -1,9 +1,11 @@
-[gd_scene load_steps=9 format=2]
+[gd_scene load_steps=13 format=2]
[ext_resource path="res://Scenes/Dungeon.gd" type="Script" id=1]
[ext_resource path="res://Scenes/CameraControl.gd" type="Script" id=2]
[ext_resource path="res://Assets/Environment/Floor_tile.png" type="Texture" id=3]
[ext_resource path="res://Scenes/UIController.gd" type="Script" id=4]
+[ext_resource path="res://Assets/AlegreyaSansSC-ExtraBold.ttf" type="DynamicFontData" id=5]
+[ext_resource path="res://Scenes/ScoreParticle.tscn" type="PackedScene" id=6]
[sub_resource type="PlaneMesh" id=1]
@@ -21,6 +23,18 @@ background_sky = SubResource( 2 )
ambient_light_color = Color( 1, 1, 1, 1 )
dof_blur_far_amount = 0.06
+[sub_resource type="DynamicFont" id=5]
+size = 48
+outline_size = 2
+outline_color = Color( 0, 0, 0, 1 )
+font_data = ExtResource( 5 )
+
+[sub_resource type="DynamicFont" id=6]
+size = 36
+outline_size = 2
+outline_color = Color( 0, 0, 0, 1 )
+font_data = ExtResource( 5 )
+
[node name="Dungeon" type="Spatial"]
script = ExtResource( 1 )
@@ -50,10 +64,45 @@ size = 7.35
transform = Transform( 0.73644, 0.441272, -0.512773, 0, 0.757975, 0.652284, 0.676503, -0.480367, 0.558203, 0, 35.1428, 0 )
light_energy = 0.5
-[node name="CanvasLayer" type="CanvasLayer" parent="."]
+[node name="UIController" type="CanvasLayer" parent="."]
script = ExtResource( 4 )
-[node name="NumberOfTurns" type="Label" parent="CanvasLayer"]
-margin_right = 40.0
-margin_bottom = 14.0
-rect_scale = Vector2( 2, 2 )
+[node name="NumberOfTurns" type="Label" parent="UIController"]
+margin_left = 7.0
+margin_top = 7.0
+margin_right = 291.0
+margin_bottom = 56.0
+custom_fonts/font = SubResource( 5 )
+text = "Turns left: 20"
+
+[node name="Objectives" type="Label" parent="UIController"]
+anchor_left = 1.0
+anchor_right = 1.0
+margin_left = -610.0
+margin_top = 5.0
+margin_right = -9.0
+margin_bottom = 54.0
+custom_fonts/font = SubResource( 6 )
+text = "(0/1) Activate the Crystals!"
+align = 2
+valign = 2
+
+[node name="Particles" type="Control" parent="UIController"]
+
+[node name="ScoreParticle" parent="UIController/Particles" instance=ExtResource( 6 )]
+visible = false
+
+[node name="ScoreParticle2" parent="UIController/Particles" instance=ExtResource( 6 )]
+visible = false
+
+[node name="ScoreParticle3" parent="UIController/Particles" instance=ExtResource( 6 )]
+visible = false
+
+[node name="ScoreParticle4" parent="UIController/Particles" instance=ExtResource( 6 )]
+visible = false
+
+[node name="ScoreParticle5" parent="UIController/Particles" instance=ExtResource( 6 )]
+visible = false
+
+[node name="ScoreParticle6" parent="UIController/Particles" instance=ExtResource( 6 )]
+visible = false
diff --git a/Scenes/PlateKey.tscn b/Scenes/PlateKey.tscn
index 0b21ead..f90a645 100644
--- a/Scenes/PlateKey.tscn
+++ b/Scenes/PlateKey.tscn
@@ -11,6 +11,7 @@ albedo_color = Color( 0.34902, 0.541176, 0.835294, 1 )
[node name="PlateKey" type="Spatial"]
script = ExtResource( 1 )
valid_symbols = [ "1", "2", "3" ]
+door_path = null
[node name="Mesh" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.025, 0 )
diff --git a/Scenes/ScoreParticle.gd b/Scenes/ScoreParticle.gd
new file mode 100644
index 0000000..51a23f5
--- /dev/null
+++ b/Scenes/ScoreParticle.gd
@@ -0,0 +1,18 @@
+extends TextureRect
+
+onready var animation_player = $AnimationPlayer
+
+func animate():
+ var anim = animation_player.get_animation("Animate")
+ anim = anim.duplicate() as Animation
+
+ var v = anim.track_get_key_value(0,0)
+ v[0] = rect_position.x
+ anim.track_set_key_value(0,0,v)
+
+ v = anim.track_get_key_value(1,0)
+ v[0] = rect_position.y
+ anim.track_set_key_value(1,0,v)
+
+ animation_player.add_animation("Animate", anim)
+ animation_player.play("Animate")
diff --git a/Scenes/ScoreParticle.tscn b/Scenes/ScoreParticle.tscn
new file mode 100644
index 0000000..99d70e1
--- /dev/null
+++ b/Scenes/ScoreParticle.tscn
@@ -0,0 +1,87 @@
+[gd_scene load_steps=5 format=2]
+
+[ext_resource path="res://Scenes/ScoreParticle.gd" type="Script" id=1]
+[ext_resource path="res://icon.png" type="Texture" id=2]
+
+[sub_resource type="Animation" id=7]
+resource_name = "Animate"
+length = 0.4
+tracks/0/type = "bezier"
+tracks/0/path = NodePath(".:rect_position:x")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/keys = {
+"points": PoolRealArray( 508, -0.25, 0, 0.25, 0, 232, -0.25, 0, 0.25, 0 ),
+"times": PoolRealArray( 0, 0.4 )
+}
+tracks/1/type = "bezier"
+tracks/1/path = NodePath(".:rect_position:y")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/keys = {
+"points": PoolRealArray( 260, -0.25, 0, 0.075, -163.46, 2, -0.1, -0.845123, 0.25, 0 ),
+"times": PoolRealArray( 0, 0.4 )
+}
+tracks/2/type = "value"
+tracks/2/path = NodePath(".:visible")
+tracks/2/interp = 1
+tracks/2/loop_wrap = true
+tracks/2/imported = false
+tracks/2/enabled = true
+tracks/2/keys = {
+"times": PoolRealArray( 0, 0.4 ),
+"transitions": PoolRealArray( 1, 1 ),
+"update": 1,
+"values": [ true, false ]
+}
+
+[sub_resource type="Animation" id=8]
+length = 0.001
+tracks/0/type = "value"
+tracks/0/path = NodePath(".:rect_position")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/keys = {
+"times": PoolRealArray( 0 ),
+"transitions": PoolRealArray( 1 ),
+"update": 0,
+"values": [ Vector2( 508, 260 ) ]
+}
+tracks/1/type = "bezier"
+tracks/1/path = NodePath(".:rect_position:x")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/keys = {
+"points": PoolRealArray( 508, -0.25, 0, 0.25, 0 ),
+"times": PoolRealArray( 0 )
+}
+tracks/2/type = "bezier"
+tracks/2/path = NodePath(".:rect_position:y")
+tracks/2/interp = 1
+tracks/2/loop_wrap = true
+tracks/2/imported = false
+tracks/2/enabled = true
+tracks/2/keys = {
+"points": PoolRealArray( 260, -0.25, 0, 0.25, 0 ),
+"times": PoolRealArray( 0 )
+}
+
+[node name="ScoreParticle" type="TextureRect"]
+margin_left = 508.0
+margin_top = 260.0
+margin_right = 572.0
+margin_bottom = 324.0
+texture = ExtResource( 2 )
+script = ExtResource( 1 )
+
+[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
+anims/Animate = SubResource( 7 )
+anims/RESET = SubResource( 8 )
diff --git a/Scenes/UIController.gd b/Scenes/UIController.gd
index 1599d03..02312d1 100644
--- a/Scenes/UIController.gd
+++ b/Scenes/UIController.gd
@@ -1,8 +1,21 @@
extends CanvasLayer
+onready var main_camera = get_viewport().get_camera()
+onready var ScoreParticle = preload("res://Scenes/ScoreParticle.tscn")
+onready var particles = $Particles
+
func _ready():
Global.connect("update_ui", self, "_on_update_ui")
_on_update_ui()
func _on_update_ui():
- $NumberOfTurns.text = "Number of turns: %d" % Global.turns
+ $NumberOfTurns.text = "Turns left: %d" % Global.turns
+
+func on_monster_killed(monster_pos, score):
+ for i in range(score):
+ var score_particle = particles.get_child(i % 6)
+ score_particle.rect_position = main_camera.unproject_position(monster_pos)
+ score_particle.animate()
+ yield(get_tree().create_timer(0.1),"timeout")
+
+