Skip to content

Commit

Permalink
finished cannon stage
Browse files Browse the repository at this point in the history
  • Loading branch information
jovi-j committed Nov 30, 2023
1 parent e9204b4 commit 7a1cfa8
Show file tree
Hide file tree
Showing 15 changed files with 472 additions and 22 deletions.
1 change: 1 addition & 0 deletions Code/Characters/Player/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func _ready():
reloadBar.value = 0.0
reloadBar.self_modulate = Color(Color.WHITE, 0.0)
set_objetivo_text(objetivoText)
$HUD/AnimationPlayer.play("objetivo_pisca")


func hit():
Expand Down
8 changes: 8 additions & 0 deletions Code/Dialog/cap_2_5_prologo.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends Control

func _ready():
$AnimationPlayer.play("Text")


func goto_next():
get_tree().change_scene_to_file("res://Scenes/Dialog/cutscene_2_5.tscn")
51 changes: 51 additions & 0 deletions Code/Dialog/cutscene_2_5.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
extends Control

@onready var fotoPessoaTextureRect : TextureRect = $NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer/FotoPessoa
@onready var textoTela : RichTextLabel = $NinePatchRect/MarginContainer/HBoxContainer/MarginContainer/Texto
@onready var tituloPessoa : Label = $NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer/NomePessoa
@export var nextScene : PackedScene

@export var fotos : Array

#fotos
enum {
CAP=0,
SL1=1,
SL2=2
}


var can_go_to_next : bool = true

var dialogos = [
Dialogo.new(CAP, "Natal foi tomada! Estamos sendo atacados de todas as frentes, defendam-se soldados! Não nos renderemos!!", "Capitão Mor Gouveia"),
Dialogo.new(SL1, "Oh céus… Aquilo ali nas dunas é um bombardeiro? Deus nos proteja.", "Soldado"),
]

var curr_dialogo = 0


func _ready():
$AnimationPlayer.play("intro")

func _input(_event):
if Input.is_action_just_pressed("interact") or Input.is_action_just_pressed("ui_accept") or Input.is_action_just_pressed("primary"):
if $AnimationPlayer.is_playing():
$AnimationPlayer.advance(10)
else:
curr_dialogo += 1
playDialogos()


func playDialogos():
if curr_dialogo >= dialogos.size():
get_tree().change_scene_to_packed(nextScene)
return
playText(dialogos[curr_dialogo].foto, dialogos[curr_dialogo].texto, dialogos[curr_dialogo].titulo)


func playText(fotoPessoa : int, texto: String, titulo : String):
textoTela.text = texto
fotoPessoaTextureRect.texture = fotos[fotoPessoa]
tituloPessoa.text = titulo
$AnimationPlayer.play("new_animation")
1 change: 0 additions & 1 deletion Code/Misc/CannonballSpawner.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func _on_timer_timeout():
var cannonball_instance : CannonBall = cannon_ball.instantiate()
cannonball_instance.global_position = point.global_position
add_child(cannonball_instance)
print(cannonball_instance.global_position)
if randi_range(0,5) == 1:
var another_cannonball_instance : CannonBall = cannon_ball.instantiate()
another_cannonball_instance.global_position = another_point.global_position
Expand Down
31 changes: 30 additions & 1 deletion Scenes/Characters/Player/Player.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://cqmcpt8qutle4"]
[gd_scene load_steps=18 format=3 uid="uid://cqmcpt8qutle4"]

[ext_resource type="PackedScene" uid="uid://ixb44jte5b2g" path="res://Scenes/Characters/generic_character.tscn" id="1_2g2g3"]
[ext_resource type="Script" path="res://Code/Characters/Player/Player.gd" id="2_nd0rh"]
Expand Down Expand Up @@ -43,6 +43,26 @@ height = 768
fill_from = Vector2(0.5, 1)
fill_to = Vector2(0.5, 0)

[sub_resource type="Animation" id="Animation_nvee0"]
resource_name = "objetivo_pisca"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MarginContainer/HBox/LadoDIreito:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(100, 100, 100, 1), Color(1, 1, 1, 1)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_ktiuf"]
_data = {
"objetivo_pisca": SubResource("Animation_nvee0")
}

[node name="Player" groups=["player"] instance=ExtResource("1_2g2g3")]
collision_layer = 1
collision_mask = 190
Expand All @@ -56,6 +76,9 @@ texture = ExtResource("3_u630a")
collision_layer = 1
collision_mask = 4

[node name="EspadaColision" parent="Espada" index="1"]
disabled = false

[node name="Camera2DPlus" type="Camera2D" parent="." index="4"]
zoom = Vector2(0.6, 0.6)
position_smoothing_enabled = true
Expand Down Expand Up @@ -146,6 +169,7 @@ show_percentage = false
metadata/_edit_use_anchors_ = true

[node name="LadoDIreito" type="VBoxContainer" parent="HUD/MarginContainer/HBox" index="1"]
modulate = Color(100, 100, 100, 1)
layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 0
Expand Down Expand Up @@ -185,5 +209,10 @@ theme_override_colors/font_shadow_color = Color(0.0745098, 0.00784314, 0.0313726
theme_override_font_sizes/font_size = 50
text = "Pressione 'R' para tentar novamente."

[node name="AnimationPlayer" type="AnimationPlayer" parent="HUD" index="3"]
libraries = {
"": SubResource("AnimationLibrary_ktiuf")
}

[connection signal="gun_ready" from="Arcabuz" to="." method="_on_arcabuz_gun_ready"]
[connection signal="timeout" from="Arcabuz/ReloadTimer" to="Arcabuz" method="_on_reload_timer_timeout"]
2 changes: 0 additions & 2 deletions Scenes/Dialog/Cutscene_1.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,13 @@ alignment = 1

[node name="FotoPessoa" type="TextureRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2
texture = ExtResource("3_ng33l")
stretch_mode = 3

[node name="NomePessoa" type="Label" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0.835294, 0.235294, 0.415686, 1)
theme_override_colors/font_outline_color = Color(1, 0.509804, 0.454902, 1)
theme_override_font_sizes/font_size = 32
text = "Capitão Mor Gouveia"
horizontal_alignment = 1

[node name="MarginContainer" type="MarginContainer" parent="NinePatchRect/MarginContainer/HBoxContainer"]
Expand Down
122 changes: 122 additions & 0 deletions Scenes/Dialog/cap_2_5_prologo.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[gd_scene load_steps=5 format=3 uid="uid://bb28sae163k2m"]

[ext_resource type="Script" path="res://Code/Dialog/cap_2_5_prologo.gd" id="1_ehbs6"]

[sub_resource type="Animation" id="Animation_3fj83"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible_ratio")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}

[sub_resource type="Animation" id="Animation_117ic"]
resource_name = "Text"
length = 6.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible_ratio")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 3.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 1.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 7),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(4.8, 5.6),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("../..")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(6),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_next"
}]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_rstvp"]
_data = {
"RESET": SubResource("Animation_3fj83"),
"Text": SubResource("Animation_117ic")
}

[node name="Cap2Prologo" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ehbs6")

[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="Label" type="Label" parent="CenterContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0.835294, 0.235294, 0.415686, 1)
theme_override_colors/font_shadow_color = Color(1, 0.509804, 0.454902, 1)
theme_override_font_sizes/font_size = 50
text = "Natal, 10 de dezembro de 1633
Forte dos Reis Magos"
horizontal_alignment = 1

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../CenterContainer/Label")
libraries = {
"": SubResource("AnimationLibrary_rstvp")
}
11 changes: 11 additions & 0 deletions Scenes/Dialog/cap_2_prologo.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends Control



func _ready():
$AnimationPlayer.play("Text")


func goto_next():
get_tree().change_scene_to_file("res://Scenes/Dialog/cutscene_2.tscn")

2 changes: 1 addition & 1 deletion Scenes/Dialog/cap_2_prologo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ layout_mode = 2
theme_override_colors/font_color = Color(0.835294, 0.235294, 0.415686, 1)
theme_override_colors/font_shadow_color = Color(1, 0.509804, 0.454902, 1)
theme_override_font_sizes/font_size = 50
text = "Natal, 10 de dezembro de 1633
text = "Natal, 11 de dezembro de 1633
Forte dos Reis Magos"
horizontal_alignment = 1

Expand Down
16 changes: 8 additions & 8 deletions Scenes/Dialog/cutscene_2.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=11 format=3 uid="uid://dob43j70hrtm8"]
[gd_scene load_steps=12 format=3 uid="uid://dob43j70hrtm8"]

[ext_resource type="PackedScene" uid="uid://dbqyy8261eg2f" path="res://Scenes/Dialog/mostra_controles.tscn" id="2_fx36t"]
[ext_resource type="PackedScene" uid="uid://ccfw6oprl2ugv" path="res://Scenes/Stages/Mapa02.tscn" id="1_1q3g1"]
[ext_resource type="Texture2D" uid="uid://dt2xvl1m2gv8y" path="res://Assets/Sprites/Dialog/comandante.png" id="3_12p4y"]
[ext_resource type="Texture2D" uid="uid://bg2ym571sftms" path="res://Assets/Sprites/Dialog/soldado1.png" id="4_hrhe8"]
[ext_resource type="Texture2D" uid="uid://dyb3yb1f265wu" path="res://Assets/Sprites/Dialog/soldado2.png" id="4_md1br"]
[ext_resource type="Texture2D" uid="uid://cjogeblnh0m4v" path="res://Assets/Sprites/Dialog/dialogpatch.png" id="5_d4nq6"]
[ext_resource type="Texture2D" uid="uid://cptlibwhggl6q" path="res://Assets/Sprites/Dialog/forte.jpg" id="5_t6lyj"]

Expand All @@ -27,8 +28,9 @@ enum {
var can_go_to_next : bool = true

var dialogos = [
Dialogo.new(CAP, \"Natal foi tomada! Estamos sendo atacados de todas as frentes, defendam-se soldados! Não nos renderemos!!\", \"Capitão Mor Gouveia\"),
Dialogo.new(SL1, \"Oh céus… Aquilo ali nas dunas é um bombardeiro? Deus nos proteja.\", \"Soldado\")
Dialogo.new(SL1, \"Eu não sei vocês… mas eu não estou pronto para morrer. Não dessa forma\", \"Soldado A\"),
Dialogo.new(SL2, \"O Capitão está ferido. Agora estamos por nossa conta. O que devemos fazer?\", \"Soldado B\"),
Dialogo.new(SL1, \"…eu tenho uma ideia.\", \"Soldado A\")
]

var curr_dialogo = 0
Expand Down Expand Up @@ -140,8 +142,8 @@ offset_bottom = 119.04
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_4cg6e")
nextScene = ExtResource("2_fx36t")
fotos = [ExtResource("3_12p4y"), ExtResource("4_hrhe8")]
nextScene = ExtResource("1_1q3g1")
fotos = [ExtResource("3_12p4y"), ExtResource("4_hrhe8"), ExtResource("4_md1br")]
[node name="Fundo" type="TextureRect" parent="."]
self_modulate = Color(1, 1, 1, 0.313726)
Expand Down Expand Up @@ -197,15 +199,13 @@ alignment = 1
[node name="FotoPessoa" type="TextureRect" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2
texture = ExtResource("3_12p4y")
stretch_mode = 3
[node name="NomePessoa" type="Label" parent="NinePatchRect/MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0.835294, 0.235294, 0.415686, 1)
theme_override_colors/font_outline_color = Color(1, 0.509804, 0.454902, 1)
theme_override_font_sizes/font_size = 32
text = "Capitão Mor Gouveia"
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="NinePatchRect/MarginContainer/HBoxContainer"]
Expand Down
Loading

0 comments on commit 7a1cfa8

Please sign in to comment.