Skip to content

Commit 7f0317e

Browse files
committed
Draft combat triggers and arenas
1 parent 74ce461 commit 7f0317e

File tree

13 files changed

+181
-26
lines changed

13 files changed

+181
-26
lines changed

assets/gui/emotes/emote_combat.png

283 Bytes
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://g50qvrryt4cb"
6+
path="res://.godot/imported/emote_combat.png-a6eedb2e63af4d03438055536a747378.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://assets/gui/emotes/emote_combat.png"
14+
dest_files=["res://.godot/imported/emote_combat.png-a6eedb2e63af4d03438055536a747378.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1

maps/test_combat_arena.tscn

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[gd_scene load_steps=4 format=3 uid="uid://wivtmf75ic3f"]
2+
3+
[ext_resource type="PackedScene" uid="uid://b3ciqydkjnkkx" path="res://src/combat/combat_arena.tscn" id="1_etpkf"]
4+
[ext_resource type="Texture2D" uid="uid://w55nt3s833tb" path="res://assets/arenas/steppes.png" id="2_i30nm"]
5+
[ext_resource type="Texture2D" uid="uid://e4b6flk7roy3" path="res://assets/battlers/bugcat.png" id="3_rfyrg"]
6+
7+
[node name="TestCombatArena" instance=ExtResource("1_etpkf")]
8+
9+
[node name="Background" parent="." index="0"]
10+
texture = ExtResource("2_i30nm")
11+
12+
[node name="Sprite2D" type="Sprite2D" parent="Battlers" index="0"]
13+
position = Vector2(538, 550)
14+
texture = ExtResource("3_rfyrg")
15+
16+
[node name="Sprite2D2" type="Sprite2D" parent="Battlers" index="1"]
17+
position = Vector2(362, 702)
18+
texture = ExtResource("3_rfyrg")

maps/test_combat_arena2.tscn

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[gd_scene load_steps=5 format=3 uid="uid://bq6b26pctmol4"]
2+
3+
[ext_resource type="PackedScene" uid="uid://b3ciqydkjnkkx" path="res://src/combat/combat_arena.tscn" id="1_tqh6v"]
4+
[ext_resource type="Texture2D" uid="uid://w55nt3s833tb" path="res://assets/arenas/steppes.png" id="2_5pnp5"]
5+
[ext_resource type="Texture2D" uid="uid://dr8cs6liv45hd" path="res://assets/battlers/wolf.png" id="3_d5gu6"]
6+
[ext_resource type="Texture2D" uid="uid://cbgfjvlm8kx4k" path="res://assets/battlers/squirrel.png" id="4_kpf44"]
7+
8+
[node name="TestCombatArena" instance=ExtResource("1_tqh6v")]
9+
10+
[node name="Background" parent="." index="0"]
11+
texture = ExtResource("2_5pnp5")
12+
13+
[node name="Sprite2D" type="Sprite2D" parent="Battlers" index="0"]
14+
position = Vector2(586, 485)
15+
texture = ExtResource("3_d5gu6")
16+
17+
[node name="Sprite2D2" type="Sprite2D" parent="Battlers" index="1"]
18+
position = Vector2(243, 658)
19+
texture = ExtResource("4_kpf44")
20+
21+
[node name="Sprite2D3" type="Sprite2D" parent="Battlers" index="2"]
22+
position = Vector2(602, 777)
23+
texture = ExtResource("4_kpf44")

project.godot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ config/icon="res://icon.svg"
1818
[autoload]
1919

2020
Camera="*res://src/field/field_camera.gd"
21+
CombatEvents="*res://src/common/combat_events.gd"
2122
Dialogic="*res://addons/dialogic/Other/DialogicGameHandler.gd"
2223
FieldEvents="*res://src/common/field_events.gd"
2324
Music="*res://src/common/music/music_player.tscn"
@@ -158,4 +159,3 @@ renderer/rendering_method="gl_compatibility"
158159
renderer/rendering_method.mobile="gl_compatibility"
159160
textures/vram_compression/import_etc2_astc=true
160161
textures/default_filters/anisotropic_filtering_level=0
161-
environment/defaults/default_clear_color=Color(0, 0, 0, 1)

src/combat/combat.gd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
extends CanvasLayer
22

3+
var _active_arena: CombatArena = null
4+
5+
6+
func _on_combat_initiated(arena: PackedScene) -> void:
7+
# Don't start a new combat if one is currently ongoing.
8+
if _active_arena:
9+
return
10+
11+
# Try to setup the combat arena (which comes with AI battlers, etc.).
12+
var new_arena: = arena.instantiate()
13+
assert(new_arena is CombatArena,
14+
"Failed to initiate combat. Provided 'arena' arugment is not a CombatArena.")
15+
add_child(new_arena)

src/combat/combat_arena.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class_name CombatArena extends Control
2+
3+
@export var music: AudioStream

src/combat/combat_arena.tscn

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://b3ciqydkjnkkx"]
2+
3+
[ext_resource type="Script" path="res://src/combat/combat_arena.gd" id="1_iqdn5"]
4+
5+
[node name="CombatArena" type="Control"]
6+
custom_minimum_size = Vector2(1920, 1080)
7+
layout_mode = 3
8+
anchors_preset = 15
9+
anchor_right = 1.0
10+
anchor_bottom = 1.0
11+
grow_horizontal = 2
12+
grow_vertical = 2
13+
script = ExtResource("1_iqdn5")
14+
15+
[node name="Background" type="TextureRect" parent="."]
16+
layout_mode = 0
17+
offset_right = 40.0
18+
offset_bottom = 40.0
19+
20+
[node name="Battlers" type="Node2D" parent="."]
21+
y_sort_enabled = true
22+
23+
[node name="Foreground" type="Control" parent="."]
24+
anchors_preset = 0
25+
offset_right = 40.0
26+
offset_bottom = 40.0

src/common/combat_events.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## A signal bus to connect distant scenes to various combat-exclusive events.
2+
extends Node
3+
4+
## Emitted whenever a combat is triggered. Technically, this event occurs within the field state.
5+
signal combat_initiated(arena: PackedScene)

src/field/cutscenes/popups/interaction_popup.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
class_name InteractionPopup extends UIPopup
77

88
## The different emote types that may be selected.
9-
enum EmoteTypes { EMPTY, EXCLAMATION, QUESTION}
9+
enum EmoteTypes { COMBAT, EMPTY, EXCLAMATION, QUESTION}
1010

1111
## The emote textures that may appear over a point of interest.
1212
const EMOTES: = {
13+
EmoteTypes.COMBAT: preload("res://assets/gui/emotes/emote_combat.png"),
1314
EmoteTypes.EMPTY: preload("res://assets/gui/emotes/emote__.png"),
1415
EmoteTypes.EXCLAMATION: preload("res://assets/gui/emotes/emote_exclamations.png"),
1516
EmoteTypes.QUESTION: preload("res://assets/gui/emotes/emote_question.png"),
1617
}
1718

1819
## The emote bubble that will be displayed when the character is nearby.
19-
@export var emote: EmoteTypes:
20+
@export var emote: = EmoteTypes.EMPTY:
2021
set(value):
2122
emote = value
2223

0 commit comments

Comments
 (0)