Compare commits

...

2 commits

Author SHA1 Message Date
Raxki 533bc2c60b Make some gameplay tweaks 2024-09-23 20:40:11 -04:00
Raxki a24a4e1403 Add placeholder UI and NPCs 2024-09-23 20:39:50 -04:00
28 changed files with 623 additions and 52 deletions

1
.gitattributes vendored
View file

@ -1,3 +1,4 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
*.png filter=lfs diff=lfs merge=lfs -text lockable
*.[tT][tT][fF] filter=lfs diff=lfs merge=lfs -text lockable

View file

@ -227,17 +227,18 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
graph_offset = Vector2(273, 34)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 8.0
radius = 9.0
height = 36.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bdqvd"]
size = Vector2(13, 8)
[sub_resource type="CircleShape2D" id="CircleShape2D_md645"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
height = 20.0
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hxosv"]
radius = 12.0
height = 44.0
radius = 13.0
height = 36.0
[sub_resource type="Resource" id="Resource_ri8lv"]
script = ExtResource("9_ak1rc")
@ -252,6 +253,7 @@ y_sort_enabled = true
collision_layer = 5
motion_mode = 1
script = ExtResource("1_inmen")
reduce_recoil_time_threshold = 0.75
[node name="Sprite2D" type="Sprite2D" parent="."]
modulate = Color(0.498039, 0.498039, 0.498039, 1)
@ -277,14 +279,13 @@ parameters/melee/2/blend_position = Vector2(0, 0)
parameters/walk/blend_position = Vector2(-0.0100167, -0.0729166)
[node name="Hitbox" type="Area2D" parent="."]
visible = false
position = Vector2(0, 1)
collision_layer = 2
collision_mask = 10
metadata/_edit_lock_ = true
[node name="Collider" type="CollisionShape2D" parent="Hitbox"]
visible = false
position = Vector2(0, -14)
position = Vector2(0, -13)
shape = SubResource("CapsuleShape2D_vm050")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
@ -293,26 +294,22 @@ position = Vector2(-0.5, -1)
shape = SubResource("RectangleShape2D_bdqvd")
[node name="Attackbox" type="Area2D" parent="."]
visible = false
position = Vector2(0, 1)
collision_layer = 8
collision_mask = 2
input_pickable = false
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
visible = false
position = Vector2(0, -10)
shape = SubResource("CircleShape2D_md645")
shape = SubResource("CapsuleShape2D_m3ug4")
disabled = true
debug_color = Color(0.745098, 0.462745, 0, 0.419608)
[node name="Meleebox" type="Area2D" parent="."]
visible = false
collision_layer = 4
[node name="DetectionArea" type="CollisionShape2D" parent="Meleebox"]
visible = false
position = Vector2(0, -13)
position = Vector2(0, -12)
shape = SubResource("CapsuleShape2D_hxosv")
debug_color = Color(0.784314, 0.423529, 0.27451, 0.419608)

View file

@ -1,4 +1,4 @@
[gd_resource type="AnimationLibrary" load_steps=34 format=3 uid="uid://dincs5x4qucal"]
[gd_resource type="AnimationLibrary" load_steps=35 format=3 uid="uid://dincs5x4qucal"]
[ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="1_hc7kj"]
[ext_resource type="Texture2D" uid="uid://rcidedgcjqg6" path="res://Hiro/Hiro Hurt Sprites.png" id="2_2k6ad"]
@ -6,6 +6,9 @@
[ext_resource type="Texture2D" uid="uid://06a1bf8kjte6" path="res://Hiro/Hiro Defeated Sprites nb.png" id="4_fugxd"]
[ext_resource type="Texture2D" uid="uid://byc7mqu65fb4a" path="res://Hiro/Hiro Defeated Nude Sprites Line.png" id="5_0f03l"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
height = 20.0
[sub_resource type="Animation" id="Animation_04piu"]
length = 0.40001
step = 0.5
@ -76,10 +79,10 @@ tracks/5/path = NodePath("Attackbox/Collider:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"times": PackedFloat32Array(0, 0.0666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, -10)]
"values": [Vector2(0, -10), Vector2(0, -14)]
}
tracks/6/type = "value"
tracks/6/imported = false
@ -105,6 +108,18 @@ tracks/7/keys = {
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Attackbox/Collider:shape")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_ry0wg"]
resource_name = "ai_defeated"
@ -790,7 +805,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(6, -11), Vector2(6, -11), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -14), Vector2(4, -14), Vector2(4, -14), Vector2(0.999395, -14)]
}
[sub_resource type="Animation" id="Animation_cuaji"]
@ -879,7 +894,19 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -27), Vector2(12, -11), Vector2(0, -27), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -23), Vector2(12, -11), Vector2(0, -23), Vector2(0.999395, -14)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Attackbox/Collider:shape")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0.133333),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_hqga6"]
@ -968,7 +995,19 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -2), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -3), Vector2(12, -11), Vector2(0, -3), Vector2(-0.00060463, -11)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Attackbox/Collider:shape")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0.2),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_s8xim"]
@ -1057,7 +1096,19 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(-4, -14), Vector2(-0.00060463, -11)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Attackbox/Collider:shape")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0.2),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_g1svr"]
@ -1199,7 +1250,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(4, -11), Vector2(6, -11), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(4, -14), Vector2(4, -14), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_ar6r3"]
@ -1285,10 +1336,10 @@ tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(6, -11), Vector2(6, -11), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -14), Vector2(4, -14), Vector2(4, -14), Vector2(0.999395, -14)]
}
[sub_resource type="Animation" id="Animation_1e0v6"]
@ -1338,7 +1389,7 @@ tracks/3/path = NodePath("Sprite2D:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2),
"times": PackedFloat32Array(0, 0.0666667, 0.1334, 0.2),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [31, 32, 33, 34]
@ -1377,7 +1428,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -27), Vector2(12, -11), Vector2(0, -27), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -23), Vector2(12, -11), Vector2(0, -23), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_bwm5c"]
@ -1466,7 +1517,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -26), Vector2(12, -11), Vector2(0, -26), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -23), Vector2(12, -11), Vector2(0, -23), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_qmuik"]
@ -1555,7 +1606,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -4), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -3), Vector2(12, -11), Vector2(0, -3), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_bw220"]
@ -1644,7 +1695,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -2), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(0, -3), Vector2(12, -11), Vector2(0, -3), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_wjl2t"]
@ -1733,7 +1784,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(12, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(12, -11), Vector2(-4, -14), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_e4rxs"]
@ -1822,7 +1873,7 @@ tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(12, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)]
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(12, -11), Vector2(-4, -14), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_de3xn"]

View file

@ -223,13 +223,14 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
graph_offset = Vector2(12, 21.3541)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 8.0
radius = 9.0
height = 36.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bdqvd"]
size = Vector2(13, 8)
[sub_resource type="CircleShape2D" id="CircleShape2D_md645"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
height = 20.0
[node name="HiroPlayer" type="CharacterBody2D"]
y_sort_enabled = true
@ -265,7 +266,7 @@ collision_layer = 2
collision_mask = 10
[node name="Collider" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(0, -14)
position = Vector2(0, -13)
shape = SubResource("CapsuleShape2D_vm050")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
@ -281,7 +282,7 @@ input_pickable = false
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
position = Vector2(0, -10)
shape = SubResource("CircleShape2D_md645")
shape = SubResource("CapsuleShape2D_m3ug4")
disabled = true
debug_color = Color(0.745098, 0.462745, 0, 0.419608)

BIN
Hiro/testportrait.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7opep16uyb5r"
path="res://.godot/imported/testportrait.png-e1400284f87756f31d41c6af9ee920bd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Hiro/testportrait.png"
dest_files=["res://.godot/imported/testportrait.png-e1400284f87756f31d41c6af9ee920bd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
NPCs/npc1.png (Stored with Git LFS) Normal file

Binary file not shown.

34
NPCs/npc1.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7l1k8j3ie4qi"
path="res://.godot/imported/npc1.png-c12382b3e509a49cad820e835f37ea66.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NPCs/npc1.png"
dest_files=["res://.godot/imported/npc1.png-c12382b3e509a49cad820e835f37ea66.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
NPCs/npc2.png (Stored with Git LFS) Normal file

Binary file not shown.

34
NPCs/npc2.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dym70eidamyel"
path="res://.godot/imported/npc2.png-1d6b97c8d94e4345f9dea4b7a42e43f2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NPCs/npc2.png"
dest_files=["res://.godot/imported/npc2.png-1d6b97c8d94e4345f9dea4b7a42e43f2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
NPCs/npc3.png (Stored with Git LFS) Normal file

Binary file not shown.

34
NPCs/npc3.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://y31qyw51y7hb"
path="res://.godot/imported/npc3.png-489c2fd33a0b3bdb7286bcbe4b1ed528.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NPCs/npc3.png"
dest_files=["res://.godot/imported/npc3.png-489c2fd33a0b3bdb7286bcbe4b1ed528.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
NPCs/npc4.png (Stored with Git LFS) Normal file

Binary file not shown.

34
NPCs/npc4.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://jnub86bpiebw"
path="res://.godot/imported/npc4.png-69b0a5d764f3a3f6b53a1fedb26fef98.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NPCs/npc4.png"
dest_files=["res://.godot/imported/npc4.png-69b0a5d764f3a3f6b53a1fedb26fef98.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
NPCs/npc5.png (Stored with Git LFS) Normal file

Binary file not shown.

34
NPCs/npc5.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://baw6gijyxv1fv"
path="res://.godot/imported/npc5.png-e3bfbfb64b447d6714d910daed2c76ca.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NPCs/npc5.png"
dest_files=["res://.godot/imported/npc5.png-e3bfbfb64b447d6714d910daed2c76ca.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
NPCs/npc6.png (Stored with Git LFS) Normal file

Binary file not shown.

34
NPCs/npc6.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bcvxfjlg8mmjr"
path="res://.godot/imported/npc6.png-7db9eb6b21cae9935570f7fc4d011824.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NPCs/npc6.png"
dest_files=["res://.godot/imported/npc6.png-7db9eb6b21cae9935570f7fc4d011824.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -1,9 +1,15 @@
extends Node2D
@onready var explosion_generator = $ExplosionGenerator
@onready var battle_ui = $CanvasLayer/BattleUI
@onready var player = $HiroPlayer
@onready var ai = $HiroAI
func _ready():
battle_ui.initialize(player.health, ai.health)
battle_ui.set_player_health(player.health)
battle_ui.set_enemy_health(ai.health)
func _on_player_defeated():
if Globals.nsfw == true:
explosion_generator.spawn(player.position)

View file

@ -8,6 +8,11 @@ extends CharacterBody2D
@export var KNOCKBACK_REPOSITION_POWER = 75
@export var KNOCKBACK_RANDOMNESS = 50
@export var MELEE_RADIUS = 75
@export var chase_speed = 65
@export var approach_speed = 40
@export var min_recoil_time = 3.0/60.0
@export var max_recoil_time = 1.0
@export var reduce_recoil_time_threshold = 58.0/60.0
@onready var anim_tree: AnimationTree = $AnimationTree
@onready var anim_playback: AnimationNodeStateMachinePlayback = anim_tree["parameters/playback"]
@onready var state_machine: StateChart = $StateMachine
@ -23,7 +28,7 @@ var attack_counter_limit = 0
var wants_to_melee = false
signal _got_hurt(damage: int, attack_direction: Vector2)
signal got_hurt(new_health: int)
signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2)
signal defeated
@ -49,7 +54,6 @@ func _physics_process(_delta):
func _on_player_attack_did_hit(other, attack_power: int, attack_direction: Vector2):
if other.get_parent().get_instance_id() == get_instance_id() :
_on_ai_got_hurt(attack_power, attack_direction)
_got_hurt.emit(attack_power, attack_direction)
func _on_ai_got_hurt(attack_power: int, attack_direction: Vector2):
attacked_from = attack_direction
@ -60,8 +64,8 @@ func _on_ai_got_hurt(attack_power: int, attack_direction: Vector2):
## Thinking state
## Once some time passes out, do_thinking is called
func _on_think_state_entered():
timer = randf_range(3.0/60.0, 1.5)
if timer <= 88.0/90.0:
timer = randf_range(min_recoil_time, max_recoil_time)
if timer <= reduce_recoil_time_threshold:
timer = timer * 0.75
func _on_think_state_processing(delta):
@ -82,7 +86,7 @@ func _on_hurt_state_entered():
var facing_direction = attacked_from * -1
health = health - received_damage
hit_counter = hit_counter + 1
got_hurt.emit(health)
# 1. If hit_counter variable >= 4, then you need to make the state_machine
# # 1.1 send an event "will_reposition"
@ -155,7 +159,7 @@ func _on_defeat_state_entered():
## Aproaching
func _on_approach_state_entered():
follow_player(25)
follow_player(approach_speed)
anim_tree.set("parameters/conditions/is_moving", true)
timer = 1
@ -178,7 +182,7 @@ func _on_chase_state_entered():
anim_tree.set("parameters/conditions/is_moving", true)
func _on_chase_state_processing(_delta):
follow_player(65)
follow_player(chase_speed)
var distance = position.distance_to(player_character.position)
if distance >= MELEE_RADIUS:
state_machine.send_event("melee_aborted")

View file

@ -13,6 +13,7 @@ var can_move = true
@onready var animation_playback: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2)
signal got_hurt(new_health: int)
signal defeated
func _unhandled_input(event):
@ -97,6 +98,7 @@ func _on_enemy_attack_did_hit(other, power, attack_direction):
velocity = KNOCKBACK_POWER * knockback_direction.normalized()
animation_playback.travel("hurt")
$AnimationTree.set("parameters/conditions/melee", false)
got_hurt.emit(health)
func _on_animation_tree_animation_finished(anim_name):
if anim_name.contains("hurt") or anim_name.contains("kick") or anim_name.contains("punch"):

20
Scripts/ui.gd Normal file
View file

@ -0,0 +1,20 @@
extends Control
@onready var player_health_bar: ProgressBar = $MarginContainer/HBoxContainer/HealthBar
@onready var enemy_health_bar: ProgressBar = $MarginContainer/HBoxContainer/EnemyBar
func initialize(player_max_health: int, enemy_max_health: int):
player_health_bar.max_value = player_max_health
enemy_health_bar.max_value = enemy_max_health
func set_player_health(value: int):
player_health_bar.value = value
func set_enemy_health(value: int):
enemy_health_bar.value = value
func _on_player_got_hurt(new_health: int):
set_player_health(new_health)
func _on_enemy_got_hurt(new_health: int):
set_enemy_health(new_health)

BIN
UI/Gundam 00 font gaufont.ttf (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bgqotudi6bifk"
path="res://.godot/imported/Gundam 00 font gaufont.ttf-1ecd6928ea06702c878a588c4fcb6b99.fontdata"
[deps]
source_file="res://UI/Gundam 00 font gaufont.ttf"
dest_files=["res://.godot/imported/Gundam 00 font gaufont.ttf-1ecd6928ea06702c878a588c4fcb6b99.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

56
UI/battle_ui.tscn Normal file
View file

@ -0,0 +1,56 @@
[gd_scene load_steps=4 format=3 uid="uid://ce2tjyxwaar01"]
[ext_resource type="Script" path="res://Scripts/ui.gd" id="1_pbo7d"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3rm2j"]
bg_color = Color(0.12549, 0.72549, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_688ss"]
bg_color = Color(1, 0.25098, 0.262745, 1)
[node name="UI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_pbo7d")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 32.0
grow_horizontal = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
custom_minimum_size = Vector2(0, 16)
layout_mode = 2
[node name="HealthBar" type="ProgressBar" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
size_flags_stretch_ratio = 2.0
theme_override_styles/fill = SubResource("StyleBoxFlat_3rm2j")
step = 1.0
value = 50.0
show_percentage = false
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="EnemyBar" type="ProgressBar" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
size_flags_stretch_ratio = 2.0
theme_override_styles/fill = SubResource("StyleBoxFlat_688ss")
step = 1.0
value = 13.0
show_percentage = false

83
UI/textbox_ui.tscn Normal file
View file

@ -0,0 +1,83 @@
[gd_scene load_steps=4 format=3 uid="uid://7oi3hcf5q4o7"]
[ext_resource type="FontFile" uid="uid://bgqotudi6bifk" path="res://UI/Gundam 00 font gaufont.ttf" id="1_p6ypw"]
[ext_resource type="Texture2D" uid="uid://b7opep16uyb5r" path="res://Hiro/testportrait.png" id="2_6wmjm"]
[sub_resource type="LabelSettings" id="LabelSettings_ydgvr"]
font = ExtResource("1_p6ypw")
font_size = 18
[node name="TextboxUI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ChatboxContainer" type="Control" parent="."]
layout_mode = 1
anchor_top = 0.55
anchor_right = 1.0
anchor_bottom = 0.95
grow_horizontal = 2
grow_vertical = 0
[node name="Chatbox" type="PanelContainer" parent="ChatboxContainer"]
layout_mode = 1
anchors_preset = -1
anchor_top = 0.358
anchor_right = 0.9
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
[node name="PlacementContainer" type="Control" parent="ChatboxContainer/Chatbox"]
layout_mode = 2
[node name="NextIndicator" type="Label" parent="ChatboxContainer/Chatbox/PlacementContainer"]
layout_mode = 1
anchors_preset = -1
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = -16.0
offset_bottom = -16.0
grow_horizontal = 0
grow_vertical = 0
text = ">"
label_settings = SubResource("LabelSettings_ydgvr")
[node name="MarginContainer" type="MarginContainer" parent="ChatboxContainer/Chatbox/PlacementContainer"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.269
anchor_right = 0.919
anchor_bottom = 1.0
grow_vertical = 2
size_flags_horizontal = 0
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="Text" type="Label" parent="ChatboxContainer/Chatbox/PlacementContainer/MarginContainer"]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
size_flags_vertical = 1
text = "Hello my name is Hiro Toyama, you destroyed my gunpla. Now I'm going to kill you."
label_settings = SubResource("LabelSettings_ydgvr")
autowrap_mode = 2
text_overrun_behavior = 3
[node name="Portrait" type="TextureRect" parent="ChatboxContainer"]
layout_mode = 1
anchors_preset = -1
anchor_right = 0.286
anchor_bottom = 1.0
grow_vertical = 0
texture = ExtResource("2_6wmjm")
expand_mode = 1
stretch_mode = 5

View file

@ -21,6 +21,8 @@ Globals="*res://Scripts/globals.gd"
[display]
window/size/viewport_width=720
window/size/viewport_height=480
window/stretch/mode="viewport"
[editor]
@ -104,3 +106,4 @@ melee={
[rendering]
renderer/rendering_method="mobile"
2d/snap/snap_2d_transforms_to_pixel=true

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://bxuxjqxxqy7ce"]
[gd_scene load_steps=21 format=3 uid="uid://bxuxjqxxqy7ce"]
[ext_resource type="PackedScene" uid="uid://di21xheryhp0k" path="res://Hiro/hiro_player.tscn" id="1_c1gpq"]
[ext_resource type="PackedScene" uid="uid://b8sfype1vx5ad" path="res://Nem/nem_npc.tscn" id="1_sqt7d"]
@ -10,6 +10,14 @@
[ext_resource type="Texture2D" uid="uid://dc12iaho4b8yl" path="res://world/walls.png" id="7_pp5dn"]
[ext_resource type="PackedScene" uid="uid://c503u0i421w34" path="res://world/pillar.tscn" id="8_mxq55"]
[ext_resource type="Script" path="res://Scripts/explosion_generator.gd" id="9_df2wo"]
[ext_resource type="PackedScene" uid="uid://ce2tjyxwaar01" path="res://UI/battle_ui.tscn" id="10_hxn8m"]
[ext_resource type="Texture2D" uid="uid://b7l1k8j3ie4qi" path="res://NPCs/npc1.png" id="11_p77ah"]
[ext_resource type="PackedScene" uid="uid://7oi3hcf5q4o7" path="res://UI/textbox_ui.tscn" id="12_8pgvx"]
[ext_resource type="Texture2D" uid="uid://dym70eidamyel" path="res://NPCs/npc2.png" id="12_mlj32"]
[ext_resource type="Texture2D" uid="uid://y31qyw51y7hb" path="res://NPCs/npc3.png" id="13_6g4gt"]
[ext_resource type="Texture2D" uid="uid://jnub86bpiebw" path="res://NPCs/npc4.png" id="14_46hs3"]
[ext_resource type="Texture2D" uid="uid://baw6gijyxv1fv" path="res://NPCs/npc5.png" id="15_ppm1i"]
[ext_resource type="Texture2D" uid="uid://bcvxfjlg8mmjr" path="res://NPCs/npc6.png" id="16_cgyrp"]
[sub_resource type="Gradient" id="Gradient_3ox2i"]
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
@ -27,10 +35,9 @@ position = Vector2(-136, -190)
[node name="Sprite2D" type="Sprite2D" parent="MapElements"]
z_index = -12
position = Vector2(85.5, 165.625)
position = Vector2(147, 432)
scale = Vector2(3.89453, 652.75)
texture = SubResource("GradientTexture1D_4uhai")
metadata/_edit_lock_ = true
[node name="FightingDojoBg" type="Sprite2D" parent="MapElements"]
z_index = -5
@ -78,12 +85,13 @@ texture = ExtResource("7_pp5dn")
[node name="HiroPlayer" parent="." instance=ExtResource("1_c1gpq")]
position = Vector2(-44, -12)
speed = 80
speed = 70
[node name="Camera2D" type="Camera2D" parent="HiroPlayer"]
texture_filter = 1
offset = Vector2(0, -12)
zoom = Vector2(3, 3)
zoom = Vector2(2, 2)
position_smoothing_enabled = true
position_smoothing_speed = 3.0
[node name="ReedPlayer" parent="." instance=ExtResource("6_cn8e2")]
@ -101,20 +109,26 @@ collision_mask = 17
[node name="Floor Collission" type="CollisionPolygon2D" parent="BG Collissions"]
position = Vector2(-1341, -243)
scale = Vector2(8.83789, 4.22585)
polygon = PackedVector2Array(157.843, 76.9076, 161.464, 75.961, 172.213, 75.7244, 176.513, 76.9076, 179.22, 82.4429, 180.012, 85.7558, 180.36, 93.9456, 180.247, 114.06, 179.341, 117.373, 177.871, 119.739, 174.929, 120.922, 169.497, 120.922, 169.497, 123.525, 164.745, 123.525, 164.632, 120.922, 159.201, 120.922, 156.372, 120.213, 154.901, 117.373, 154.109, 114.533, 153.883, 94.4189, 153.883, 84.0068, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 153.883, 84.0068, 155.92, 79.9839)
polygon = PackedVector2Array(158.522, 76.9076, 161.916, 75.961, 172.213, 75.961, 175.834, 76.671, 177.757, 78.5641, 179.341, 82.8236, 180.134, 85.8999, 180.134, 93.9456, 180.134, 114.06, 179.341, 117.373, 177.871, 119.739, 174.929, 120.922, 169.497, 120.922, 169.497, 123.525, 164.745, 123.525, 164.632, 120.922, 159.201, 120.922, 156.372, 120.213, 154.901, 117.373, 154.109, 113.587, 154.109, 94.1822, 154.109, 86.1365, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 154.109, 85.8999, 154.901, 83.2969, 156.485, 78.5641)
[node name="HiroAI" parent="." node_paths=PackedStringArray("player_character") instance=ExtResource("5_r7nw4")]
position = Vector2(-1, 25)
player_character = NodePath("../HiroPlayer")
health = 250
health = 400
attack_power = 10
KNOCKBACK_POWER = 60
KNOCKBACK_REPOSITION_POWER = 90
MELEE_RADIUS = 300
[node name="ExplosionGenerator" type="Node" parent="."]
script = ExtResource("9_df2wo")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Container" type="Control" parent="CanvasLayer"]
[node name="BattleUI" parent="CanvasLayer" instance=ExtResource("10_hxn8m")]
[node name="Debug" type="Control" parent="CanvasLayer"]
visible = false
layout_mode = 3
anchor_left = 0.667
anchor_right = 1.0
@ -122,13 +136,51 @@ anchor_bottom = 1.0
grow_horizontal = 0
grow_vertical = 2
[node name="StateChartDebugger" parent="CanvasLayer/Container" instance=ExtResource("2_o5str")]
[node name="StateChartDebugger" parent="CanvasLayer/Debug" instance=ExtResource("2_o5str")]
layout_mode = 1
size_flags_horizontal = 0
enabled = false
initial_node_to_watch = NodePath("../../../HiroAI")
[node name="TextboxUI" parent="CanvasLayer" instance=ExtResource("12_8pgvx")]
[node name="NPCs" type="Node2D" parent="."]
visible = false
[node name="Npc1" type="Sprite2D" parent="NPCs"]
texture_filter = 1
position = Vector2(231, -83)
texture = ExtResource("11_p77ah")
[node name="Npc2" type="Sprite2D" parent="NPCs"]
texture_filter = 1
position = Vector2(251, -101)
texture = ExtResource("12_mlj32")
[node name="Npc3" type="Sprite2D" parent="NPCs"]
texture_filter = 1
position = Vector2(360, -87)
texture = ExtResource("13_6g4gt")
[node name="Npc4" type="Sprite2D" parent="NPCs"]
texture_filter = 1
position = Vector2(379, -92)
texture = ExtResource("14_46hs3")
[node name="Npc5" type="Sprite2D" parent="NPCs"]
texture_filter = 1
position = Vector2(328, -95)
texture = ExtResource("15_ppm1i")
[node name="Npc6" type="Sprite2D" parent="NPCs"]
texture_filter = 1
position = Vector2(285, -102)
texture = ExtResource("16_cgyrp")
[connection signal="attack_did_hit" from="HiroPlayer" to="HiroAI" method="_on_player_attack_did_hit"]
[connection signal="defeated" from="HiroPlayer" to="." method="_on_player_defeated"]
[connection signal="defeated" from="HiroPlayer" to="HiroAI" method="_on_player_been_defeated"]
[connection signal="got_hurt" from="HiroPlayer" to="CanvasLayer/BattleUI" method="_on_player_got_hurt"]
[connection signal="attack_did_hit" from="HiroAI" to="HiroPlayer" method="_on_enemy_attack_did_hit"]
[connection signal="defeated" from="HiroAI" to="." method="_on_ai_defeated"]
[connection signal="got_hurt" from="HiroAI" to="CanvasLayer/BattleUI" method="_on_enemy_got_hurt"]