Skip to content

Commit

Permalink
Add Battlers and Combat logic (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: Nathan Lovato <[email protected]>
  • Loading branch information
food-please and NathanLovato authored Jul 27, 2024
1 parent f3f3df4 commit 9000630
Show file tree
Hide file tree
Showing 44 changed files with 1,346 additions and 456 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## v0.3.1 Combat Demo ⚔️ - Battlers, Stats, and Animations

### New

Combat instances have been fleshed out to include several new combat-specific nodes:
- 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).
- BattlerStats track a Battlers given numerical characteristics, including health points.
- A BattlerAnim(ation) node brings Battlers to life, animating in response to various stimuli acting on the battler.
- an 'active turn queue' allows battlers to act in sequence as time passes.
- A Battler has a repertoire of BattlerActions, selecting one (alongside any necessary targets) to perform on its turn.

### Changes
- Combat resolves (victory or loss on the player's part) automatically when one 'team' is defeated.
- A series of cyber-themed elements dictate how Battlers and actions play out statistically.
- Actions and combat resolution wait for animations and timers to play out, allowing for a smooth combat experience.
- Miscellaneous fixes to the demo.

## v0.3.0 Combat Demo ⚔️

### New
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Bold.ttf-a0c3395776dbc11ee676c5f1ea9c0
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Italic.ttf-844485a0171d6031f98f4829003
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Roboto-Regular.ttf-d9ce0640effe9e93230b445b37
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
16 changes: 16 additions & 0 deletions assets/battlers/bear_anim.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://bl8bmbt7v3lrj"]

[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_cpjl2"]
[ext_resource type="Texture2D" uid="uid://pkp6t20skjpe" path="res://assets/battlers/bear.png" id="2_3eyxi"]
[ext_resource type="AnimationLibrary" uid="uid://o2ktahx2nkki" path="res://assets/battlers/default_battler_animations.res" id="2_c0d1t"]

[node name="BearAnim" instance=ExtResource("1_cpjl2")]

[node name="AnimationPlayer" parent="Pivot" index="0"]
libraries = {
"": ExtResource("2_c0d1t")
}

[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
texture = ExtResource("2_3eyxi")
offset = Vector2(0, -185)
106 changes: 106 additions & 0 deletions assets/battlers/bugcat_anim.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[gd_scene load_steps=7 format=3 uid="uid://ugsq7u4cue4w"]

[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_ws2uh"]
[ext_resource type="Texture2D" uid="uid://e4b6flk7roy3" path="res://assets/battlers/bugcat.png" id="2_jiam4"]

[sub_resource type="Animation" id="Animation_r4wpi"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}

[sub_resource type="Animation" id="Animation_2u36l"]
resource_name = "die"
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:position")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}

[sub_resource type="Animation" id="Animation_yc1ca"]
resource_name = "hurt"
length = 0.6
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:position")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_va8v1"]
_data = {
"RESET": SubResource("Animation_r4wpi"),
"die": SubResource("Animation_2u36l"),
"hurt": SubResource("Animation_yc1ca")
}

[node name="BugcatAnim" instance=ExtResource("1_ws2uh")]

[node name="AnimationPlayer" parent="Pivot" index="0"]
libraries = {
"": SubResource("AnimationLibrary_va8v1")
}

[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
texture = ExtResource("2_jiam4")
offset = Vector2(0, -163)
Binary file added assets/battlers/default_battler_animations.res
Binary file not shown.
106 changes: 106 additions & 0 deletions assets/battlers/squirrel_anim.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[gd_scene load_steps=7 format=3 uid="uid://cch8nxgex1edr"]

[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_d3f8c"]
[ext_resource type="Texture2D" uid="uid://cbgfjvlm8kx4k" path="res://assets/battlers/squirrel.png" id="2_0aqb7"]

[sub_resource type="Animation" id="Animation_r4wpi"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}

[sub_resource type="Animation" id="Animation_2u36l"]
resource_name = "die"
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:position")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}

[sub_resource type="Animation" id="Animation_yc1ca"]
resource_name = "hurt"
length = 0.6
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:position")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"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),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"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)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_xl0qy"]
_data = {
"RESET": SubResource("Animation_r4wpi"),
"die": SubResource("Animation_2u36l"),
"hurt": SubResource("Animation_yc1ca")
}

[node name="SquirrelAnim" instance=ExtResource("1_d3f8c")]

[node name="AnimationPlayer" parent="Pivot" index="0"]
libraries = {
"": SubResource("AnimationLibrary_xl0qy")
}

[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
texture = ExtResource("2_0aqb7")
offset = Vector2(0, -145)
16 changes: 16 additions & 0 deletions assets/battlers/wolf_anim.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://8f7e4yxs3poj"]

[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_ffl4t"]
[ext_resource type="Texture2D" uid="uid://dr8cs6liv45hd" path="res://assets/battlers/wolf.png" id="2_nnyj7"]
[ext_resource type="AnimationLibrary" uid="uid://o2ktahx2nkki" path="res://assets/battlers/default_battler_animations.res" id="2_q1kws"]

[node name="WolfAnim" instance=ExtResource("1_ffl4t")]

[node name="AnimationPlayer" parent="Pivot" index="0"]
libraries = {
"": ExtResource("2_q1kws")
}

[node name="Sprite2D" type="Sprite2D" parent="Pivot" index="1"]
texture = ExtResource("2_nnyj7")
offset = Vector2(0, -235)
Binary file added assets/characters/ ghost.atlastex
Binary file not shown.
Binary file removed assets/characters/ghost.atlastex
Binary file not shown.
4 changes: 2 additions & 2 deletions assets/characters/ghost_gfx.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://cgwailb13nkcd"]

[ext_resource type="PackedScene" uid="uid://caxhff6by5nqu" path="res://src/field/gamepieces/animation/gamepiece_animation.tscn" id="1_iqw7y"]
[ext_resource type="Texture2D" uid="uid://ber3qsogrcx52" path="res://assets/characters/ghost.atlastex" id="2_reoms"]
[ext_resource type="Texture2D" uid="uid://dopua6orsf0bs" path="res://assets/characters/ ghost.atlastex" id="2_xwhv8"]

[sub_resource type="Animation" id="Animation_sr8xj"]
length = 0.001
Expand Down Expand Up @@ -55,5 +55,5 @@ autoplay = "idle"
shape = SubResource("RectangleShape2D_b20ad")

[node name="Sprite" parent="GFX" index="0"]
texture = ExtResource("2_reoms")
texture = ExtResource("2_xwhv8")
offset = Vector2(0, -6)
1 change: 1 addition & 0 deletions assets/gui/font/Kenney Pixel.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Kenney Pixel.ttf-bc32a7a7b8d1d9a0762362cb30a2
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions assets/gui/font/SourceCodePro-Bold.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/SourceCodePro-Bold.ttf-13dab6b19191054d33554b
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
Loading

0 comments on commit 9000630

Please sign in to comment.