Skip to content

Commit 9000630

Browse files
Add Battlers and Combat logic (#218)
Co-authored-by: Nathan Lovato <[email protected]>
1 parent f3f3df4 commit 9000630

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1346
-456
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## v0.3.1 Combat Demo ⚔️ - Battlers, Stats, and Animations
4+
5+
### New
6+
7+
Combat instances have been fleshed out to include several new combat-specific nodes:
8+
- Battlers form two 'teams' and face off against each other. One team wins when the other's battlers have all been defeated (health points have been depleted).
9+
- BattlerStats track a Battlers given numerical characteristics, including health points.
10+
- A BattlerAnim(ation) node brings Battlers to life, animating in response to various stimuli acting on the battler.
11+
- an 'active turn queue' allows battlers to act in sequence as time passes.
12+
- A Battler has a repertoire of BattlerActions, selecting one (alongside any necessary targets) to perform on its turn.
13+
14+
### Changes
15+
- Combat resolves (victory or loss on the player's part) automatically when one 'team' is defeated.
16+
- A series of cyber-themed elements dictate how Battlers and actions play out statistically.
17+
- Actions and combat resolution wait for animations and timers to play out, allowing for a smooth combat experience.
18+
- Miscellaneous fixes to the demo.
19+
320
## v0.3.0 Combat Demo ⚔️
421

522
### New

addons/dialogic/Example Assets/Fonts/Roboto-Bold.ttf.import

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Bold.ttf-a0c3395776dbc11ee676c5f1ea9c0
1515
Rendering=null
1616
antialiasing=1
1717
generate_mipmaps=false
18+
disable_embedded_bitmaps=true
1819
multichannel_signed_distance_field=false
1920
msdf_pixel_range=8
2021
msdf_size=48

addons/dialogic/Example Assets/Fonts/Roboto-Italic.ttf.import

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Italic.ttf-844485a0171d6031f98f4829003
1515
Rendering=null
1616
antialiasing=1
1717
generate_mipmaps=false
18+
disable_embedded_bitmaps=true
1819
multichannel_signed_distance_field=false
1920
msdf_pixel_range=8
2021
msdf_size=48

addons/dialogic/Example Assets/Fonts/Roboto-Regular.ttf.import

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Regular.ttf-d9ce0640effe9e93230b445b37
1515
Rendering=null
1616
antialiasing=1
1717
generate_mipmaps=false
18+
disable_embedded_bitmaps=true
1819
multichannel_signed_distance_field=false
1920
msdf_pixel_range=8
2021
msdf_size=48

assets/battlers/bear_anim.tscn

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[gd_scene load_steps=4 format=3 uid="uid://bl8bmbt7v3lrj"]
2+
3+
[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_cpjl2"]
4+
[ext_resource type="Texture2D" uid="uid://pkp6t20skjpe" path="res://assets/battlers/bear.png" id="2_3eyxi"]
5+
[ext_resource type="AnimationLibrary" uid="uid://o2ktahx2nkki" path="res://assets/battlers/default_battler_animations.res" id="2_c0d1t"]
6+
7+
[node name="BearAnim" instance=ExtResource("1_cpjl2")]
8+
9+
[node name="AnimationPlayer" parent="Pivot" index="0"]
10+
libraries = {
11+
"": ExtResource("2_c0d1t")
12+
}
13+
14+
[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
15+
texture = ExtResource("2_3eyxi")
16+
offset = Vector2(0, -185)

assets/battlers/bugcat_anim.tscn

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
[gd_scene load_steps=7 format=3 uid="uid://ugsq7u4cue4w"]
2+
3+
[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_ws2uh"]
4+
[ext_resource type="Texture2D" uid="uid://e4b6flk7roy3" path="res://assets/battlers/bugcat.png" id="2_jiam4"]
5+
6+
[sub_resource type="Animation" id="Animation_r4wpi"]
7+
length = 0.001
8+
tracks/0/type = "value"
9+
tracks/0/imported = false
10+
tracks/0/enabled = true
11+
tracks/0/path = NodePath("Sprite2D:modulate")
12+
tracks/0/interp = 1
13+
tracks/0/loop_wrap = true
14+
tracks/0/keys = {
15+
"times": PackedFloat32Array(0),
16+
"transitions": PackedFloat32Array(1),
17+
"update": 0,
18+
"values": [Color(1, 1, 1, 1)]
19+
}
20+
tracks/1/type = "value"
21+
tracks/1/imported = false
22+
tracks/1/enabled = true
23+
tracks/1/path = NodePath(".:position")
24+
tracks/1/interp = 1
25+
tracks/1/loop_wrap = true
26+
tracks/1/keys = {
27+
"times": PackedFloat32Array(0),
28+
"transitions": PackedFloat32Array(1),
29+
"update": 0,
30+
"values": [Vector2(0, 0)]
31+
}
32+
33+
[sub_resource type="Animation" id="Animation_2u36l"]
34+
resource_name = "die"
35+
step = 0.05
36+
tracks/0/type = "value"
37+
tracks/0/imported = false
38+
tracks/0/enabled = true
39+
tracks/0/path = NodePath("Sprite2D:modulate")
40+
tracks/0/interp = 1
41+
tracks/0/loop_wrap = true
42+
tracks/0/keys = {
43+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 1),
44+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
45+
"update": 0,
46+
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 0.87451), Color(1, 1, 1, 0.74902), Color(1, 0, 0, 0.623529), Color(1, 1, 1, 0.498039), Color(1, 1, 1, 0)]
47+
}
48+
tracks/1/type = "value"
49+
tracks/1/imported = false
50+
tracks/1/enabled = true
51+
tracks/1/path = NodePath(".:position")
52+
tracks/1/interp = 2
53+
tracks/1/loop_wrap = true
54+
tracks/1/keys = {
55+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1),
56+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
57+
"update": 0,
58+
"values": [Vector2(0, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0)]
59+
}
60+
61+
[sub_resource type="Animation" id="Animation_yc1ca"]
62+
resource_name = "hurt"
63+
length = 0.6
64+
step = 0.05
65+
tracks/0/type = "value"
66+
tracks/0/imported = false
67+
tracks/0/enabled = true
68+
tracks/0/path = NodePath("Sprite2D:modulate")
69+
tracks/0/interp = 1
70+
tracks/0/loop_wrap = true
71+
tracks/0/keys = {
72+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6),
73+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
74+
"update": 0,
75+
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
76+
}
77+
tracks/1/type = "value"
78+
tracks/1/imported = false
79+
tracks/1/enabled = true
80+
tracks/1/path = NodePath(".:position")
81+
tracks/1/interp = 2
82+
tracks/1/loop_wrap = true
83+
tracks/1/keys = {
84+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6),
85+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
86+
"update": 0,
87+
"values": [Vector2(0, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(8, 0), Vector2(-8, 0), Vector2(8, 0), Vector2(-8, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(0, 0)]
88+
}
89+
90+
[sub_resource type="AnimationLibrary" id="AnimationLibrary_va8v1"]
91+
_data = {
92+
"RESET": SubResource("Animation_r4wpi"),
93+
"die": SubResource("Animation_2u36l"),
94+
"hurt": SubResource("Animation_yc1ca")
95+
}
96+
97+
[node name="BugcatAnim" instance=ExtResource("1_ws2uh")]
98+
99+
[node name="AnimationPlayer" parent="Pivot" index="0"]
100+
libraries = {
101+
"": SubResource("AnimationLibrary_va8v1")
102+
}
103+
104+
[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
105+
texture = ExtResource("2_jiam4")
106+
offset = Vector2(0, -163)
900 Bytes
Binary file not shown.

assets/battlers/squirrel_anim.tscn

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
[gd_scene load_steps=7 format=3 uid="uid://cch8nxgex1edr"]
2+
3+
[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_d3f8c"]
4+
[ext_resource type="Texture2D" uid="uid://cbgfjvlm8kx4k" path="res://assets/battlers/squirrel.png" id="2_0aqb7"]
5+
6+
[sub_resource type="Animation" id="Animation_r4wpi"]
7+
length = 0.001
8+
tracks/0/type = "value"
9+
tracks/0/imported = false
10+
tracks/0/enabled = true
11+
tracks/0/path = NodePath("Sprite2D:modulate")
12+
tracks/0/interp = 1
13+
tracks/0/loop_wrap = true
14+
tracks/0/keys = {
15+
"times": PackedFloat32Array(0),
16+
"transitions": PackedFloat32Array(1),
17+
"update": 0,
18+
"values": [Color(1, 1, 1, 1)]
19+
}
20+
tracks/1/type = "value"
21+
tracks/1/imported = false
22+
tracks/1/enabled = true
23+
tracks/1/path = NodePath(".:position")
24+
tracks/1/interp = 1
25+
tracks/1/loop_wrap = true
26+
tracks/1/keys = {
27+
"times": PackedFloat32Array(0),
28+
"transitions": PackedFloat32Array(1),
29+
"update": 0,
30+
"values": [Vector2(0, 0)]
31+
}
32+
33+
[sub_resource type="Animation" id="Animation_2u36l"]
34+
resource_name = "die"
35+
step = 0.05
36+
tracks/0/type = "value"
37+
tracks/0/imported = false
38+
tracks/0/enabled = true
39+
tracks/0/path = NodePath("Sprite2D:modulate")
40+
tracks/0/interp = 1
41+
tracks/0/loop_wrap = true
42+
tracks/0/keys = {
43+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 1),
44+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
45+
"update": 0,
46+
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 0.87451), Color(1, 1, 1, 0.74902), Color(1, 0, 0, 0.623529), Color(1, 1, 1, 0.498039), Color(1, 1, 1, 0)]
47+
}
48+
tracks/1/type = "value"
49+
tracks/1/imported = false
50+
tracks/1/enabled = true
51+
tracks/1/path = NodePath(".:position")
52+
tracks/1/interp = 2
53+
tracks/1/loop_wrap = true
54+
tracks/1/keys = {
55+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1),
56+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
57+
"update": 0,
58+
"values": [Vector2(0, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0)]
59+
}
60+
61+
[sub_resource type="Animation" id="Animation_yc1ca"]
62+
resource_name = "hurt"
63+
length = 0.6
64+
step = 0.05
65+
tracks/0/type = "value"
66+
tracks/0/imported = false
67+
tracks/0/enabled = true
68+
tracks/0/path = NodePath("Sprite2D:modulate")
69+
tracks/0/interp = 1
70+
tracks/0/loop_wrap = true
71+
tracks/0/keys = {
72+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6),
73+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
74+
"update": 0,
75+
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
76+
}
77+
tracks/1/type = "value"
78+
tracks/1/imported = false
79+
tracks/1/enabled = true
80+
tracks/1/path = NodePath(".:position")
81+
tracks/1/interp = 2
82+
tracks/1/loop_wrap = true
83+
tracks/1/keys = {
84+
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6),
85+
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
86+
"update": 0,
87+
"values": [Vector2(0, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(8, 0), Vector2(-8, 0), Vector2(8, 0), Vector2(-8, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(16, 0), Vector2(-16, 0), Vector2(0, 0)]
88+
}
89+
90+
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xl0qy"]
91+
_data = {
92+
"RESET": SubResource("Animation_r4wpi"),
93+
"die": SubResource("Animation_2u36l"),
94+
"hurt": SubResource("Animation_yc1ca")
95+
}
96+
97+
[node name="SquirrelAnim" instance=ExtResource("1_d3f8c")]
98+
99+
[node name="AnimationPlayer" parent="Pivot" index="0"]
100+
libraries = {
101+
"": SubResource("AnimationLibrary_xl0qy")
102+
}
103+
104+
[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
105+
texture = ExtResource("2_0aqb7")
106+
offset = Vector2(0, -145)

assets/battlers/wolf_anim.tscn

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[gd_scene load_steps=4 format=3 uid="uid://8f7e4yxs3poj"]
2+
3+
[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_ffl4t"]
4+
[ext_resource type="Texture2D" uid="uid://dr8cs6liv45hd" path="res://assets/battlers/wolf.png" id="2_nnyj7"]
5+
[ext_resource type="AnimationLibrary" uid="uid://o2ktahx2nkki" path="res://assets/battlers/default_battler_animations.res" id="2_q1kws"]
6+
7+
[node name="WolfAnim" instance=ExtResource("1_ffl4t")]
8+
9+
[node name="AnimationPlayer" parent="Pivot" index="0"]
10+
libraries = {
11+
"": ExtResource("2_q1kws")
12+
}
13+
14+
[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
15+
texture = ExtResource("2_nnyj7")
16+
offset = Vector2(0, -235)

assets/characters/ ghost.atlastex

279 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)