diff --git a/projeto/elementos/imagem/abertura/logo.png b/projeto/elementos/imagem/abertura/logo.png new file mode 100644 index 00000000..d08d1f48 Binary files /dev/null and b/projeto/elementos/imagem/abertura/logo.png differ diff --git a/projeto/elementos/musica/bgm_vinheta.mp3 b/projeto/elementos/musica/bgm_vinheta.mp3 new file mode 100644 index 00000000..f8b9940d Binary files /dev/null and b/projeto/elementos/musica/bgm_vinheta.mp3 differ diff --git a/projeto/elementos/som/bolha_2.wav b/projeto/elementos/som/bolha_2.wav new file mode 100644 index 00000000..1ec27c59 Binary files /dev/null and b/projeto/elementos/som/bolha_2.wav differ diff --git a/projeto/project.godot b/projeto/project.godot index 1cc09c00..9878dd2c 100644 --- a/projeto/project.godot +++ b/projeto/project.godot @@ -81,7 +81,7 @@ _global_script_class_icons={ [application] config/name="mtst-game-template" -run/main_scene="res://recursos/feed_de_noticias/feed_de_noticia.tscn" +run/main_scene="res://recursos/abertura/abertura.tscn" config/icon="res://elementos/imagem/icon.png" [autoload] @@ -93,6 +93,7 @@ TrocadorDeCenas="*res://addons/trocador_de_cenas/trocador_de_cenas.tscn" window/size/width=720 window/size/height=1280 +window/handheld/orientation="portrait" window/stretch/mode="2d" window/stretch/aspect="expand" diff --git a/projeto/recursos/abertura/abertura.gd b/projeto/recursos/abertura/abertura.gd new file mode 100644 index 00000000..6a4c8b25 --- /dev/null +++ b/projeto/recursos/abertura/abertura.gd @@ -0,0 +1,15 @@ +extends Control + +export(PackedScene) var proxima_cena: PackedScene + +func _ready() -> void: + $AnimationPlayer.play('abertura') + yield ($AnimationPlayer, 'animation_finished') + _pular_intro() + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("ui_accept"): + _pular_intro() + +func _pular_intro() -> void: + TrocadorDeCenas.trocar_cena(proxima_cena.resource_path) diff --git a/projeto/recursos/abertura/abertura.tscn b/projeto/recursos/abertura/abertura.tscn new file mode 100644 index 00000000..a3afee68 --- /dev/null +++ b/projeto/recursos/abertura/abertura.tscn @@ -0,0 +1,95 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://elementos/imagem/abertura/logo.png" type="Texture" id=1] +[ext_resource path="res://recursos/abertura/abertura.gd" type="Script" id=2] +[ext_resource path="res://recursos/feed_de_noticias/feed_de_noticia.tscn" type="PackedScene" id=3] +[ext_resource path="res://elementos/musica/bgm_vinheta.mp3" type="AudioStream" id=4] + +[sub_resource type="Animation" id=2] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath("AudioStreamPlayer:playing") +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": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("CenterContainer/logo:rect_scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 0, 0 ) ] +} + +[sub_resource type="Animation" id=1] +resource_name = "abertura" +length = 4.0 +tracks/0/type = "value" +tracks/0/path = NodePath("AudioStreamPlayer:playing") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( -0.1, 0, 3 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 1, +"values": [ false, true, false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("CenterContainer/logo:rect_scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0.5, 1.5, 2.5 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( -1, 1 ), Vector2( 1, 1 ) ] +} + +[node name="Abertura" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 2 ) +proxima_cena = ExtResource( 3 ) + +[node name="ColorRect" type="ColorRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.878431, 0, 0, 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/RESET = SubResource( 2 ) +anims/abertura = SubResource( 1 ) + +[node name="CenterContainer" type="CenterContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="logo" type="TextureRect" parent="CenterContainer"] +margin_left = 235.0 +margin_top = 515.0 +margin_right = 485.0 +margin_bottom = 765.0 +rect_min_size = Vector2( 250, 250 ) +rect_scale = Vector2( 1e-05, 1e-05 ) +rect_pivot_offset = Vector2( 125, 125 ) +texture = ExtResource( 1 ) +expand = true +stretch_mode = 6 + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 4 ) diff --git a/projeto/recursos/jogos/enchente/jogador/Sons.gd b/projeto/recursos/jogos/enchente/jogador/Sons.gd index 621609de..de457890 100644 --- a/projeto/recursos/jogos/enchente/jogador/Sons.gd +++ b/projeto/recursos/jogos/enchente/jogador/Sons.gd @@ -1,10 +1,22 @@ extends AudioStreamPlayer +onready var sons = { + "agua": preload ("res://elementos/som/movimento_agua.wav"), + "dano": preload ("res://elementos/som/bolha_2.wav") + } + func _on_ControleFaixa3D_iniciou_movimento(_direcao, _alvo) -> void: stop() + stream = sons.agua play() func _on_ControleFaixa3D_terminou_movimento() -> void: yield(get_tree().create_timer(1.0), "timeout") stop() + +func _on_Vida_vida_alterada(alteracao: Vida.VidaAlterada) -> void: + if !alteracao.cura: + stop() + stream = sons.dano + play() diff --git a/projeto/recursos/jogos/enchente/jogador/playerLane3D.gd b/projeto/recursos/jogos/enchente/jogador/playerLane3D.gd index 4dadde24..e824421e 100644 --- a/projeto/recursos/jogos/enchente/jogador/playerLane3D.gd +++ b/projeto/recursos/jogos/enchente/jogador/playerLane3D.gd @@ -11,3 +11,12 @@ func _on_ControladorArrasta_arrastado(chave): print('a') elif chave=='esquerda-0' or chave=='esquerda-1': controle_faixa_3d.mover_esquerda() + + +func _on_AreaDano_body_entered(body: Node) -> void: + if body.is_in_group("obstaculo"): + vida.receber_dano(1.0) + + +func _on_Vida_vida_acabou() -> void: + TrocadorDeCenas.trocar_cena('res://recursos/feed_de_noticias/feed_de_noticia.tscn') diff --git a/projeto/recursos/jogos/enchente/jogador/playerLane3D.tscn b/projeto/recursos/jogos/enchente/jogador/playerLane3D.tscn index 6744c4cb..b8438469 100644 --- a/projeto/recursos/jogos/enchente/jogador/playerLane3D.tscn +++ b/projeto/recursos/jogos/enchente/jogador/playerLane3D.tscn @@ -19,6 +19,7 @@ move_lock_z = true script = ExtResource( 3 ) [node name="CollisionShape" type="CollisionShape" parent="."] +transform = Transform( 0.9, 0, 0, 0, 0.9, 0, 0, 0, 0.9, 0, 0, 0 ) shape = SubResource( 1 ) [node name="Sprite3D" type="Sprite3D" parent="."] @@ -45,7 +46,14 @@ autoplay = true stream = ExtResource( 7 ) script = ExtResource( 8 ) +[node name="AreaDano" type="Area" parent="."] + +[node name="CollisionShape" type="CollisionShape" parent="AreaDano"] +shape = SubResource( 1 ) + [connection signal="iniciou_movimento" from="ControleFaixa3D" to="Sons" method="_on_ControleFaixa3D_iniciou_movimento"] [connection signal="terminou_movimento" from="ControleFaixa3D" to="Sons" method="_on_ControleFaixa3D_terminou_movimento"] [connection signal="arrastado" from="ControladorArrasta" to="." method="_on_ControladorArrasta_arrastado"] +[connection signal="vida_acabou" from="Vida" to="." method="_on_Vida_vida_acabou"] [connection signal="vida_alterada" from="Vida" to="Sons" method="_on_Vida_vida_alterada"] +[connection signal="body_entered" from="AreaDano" to="." method="_on_AreaDano_body_entered"]