Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Battlers and Combat logic #218

Merged
merged 23 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b4f51c3
Update Godot to 4.3b2, add battlers
food-please Jun 23, 2024
9789c8e
Setup the active turn queue
food-please Jun 23, 2024
28f7e5c
Add battler stats (L8)
food-please Jun 23, 2024
74b7ec3
Add stat bonuses & penalties (L9)
food-please Jun 25, 2024
5d22850
Implement stat multipliers (L11)
food-please Jun 25, 2024
c082a20
Clean up ghost.atlastex, battler stat checks, combat arena battler types
food-please Jun 30, 2024
ad539cf
Add BattlerAnim class and replace static Battler images
food-please Jul 6, 2024
228862b
Design ActionData to specify action properties
food-please Jul 6, 2024
65f7f0e
Allow Battlers to act, rework actions to single resource
food-please Jul 8, 2024
439a34c
Add temporary player battler
food-please Jul 8, 2024
89798ad
Flesh out melee attack action
food-please Jul 8, 2024
c740aac
Updgade to Godot 4.3 (beta3)
food-please Jul 16, 2024
6d73364
Add default 'die' and 'hurt' battler animations
food-please Jul 16, 2024
bc5613e
Finish combat once one side has fallen and animations finished
food-please Jul 16, 2024
6da44b1
Fix missing battler animations, win/lost combat appropriately
food-please Jul 17, 2024
650e622
Update changelog for 0.3.1 release
food-please Jul 24, 2024
f3b31b7
Update project code documentation
food-please Jul 24, 2024
dbf2a31
Add specific stats and actions for Battler types
food-please Jul 24, 2024
80d6979
start refactoring combat code
NathanLovato Jul 26, 2024
88c94b9
refactor combat.gd
NathanLovato Jul 26, 2024
0d625ea
refactor battler.gd
NathanLovato Jul 26, 2024
157988b
minor changes
NathanLovato Jul 26, 2024
942eba6
minor changes 2
NathanLovato Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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