Compare commits

..

2 commits

13 changed files with 133 additions and 128 deletions

View file

@ -1,5 +1,6 @@
[gd_scene load_steps=59 format=3 uid="uid://di21xheryhp0k"]
[gd_scene load_steps=61 format=3 uid="uid://di21xheryhp0k"]
[ext_resource type="Script" path="res://Scripts/hiro_player.gd" id="1_dtymi"]
[ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="1_ukwcc"]
[ext_resource type="Texture2D" uid="uid://bio3egs7q7wog" path="res://Hiro/Hiro Melee Sprites.png" id="2_d32ue"]
@ -1463,13 +1464,18 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
graph_offset = Vector2(-129, 11)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 8.0
height = 36.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bdqvd"]
size = Vector2(13, 8)
[sub_resource type="CircleShape2D" id="CircleShape2D_md645"]
[node name="HiroPlayer" type="CharacterBody2D"]
y_sort_enabled = true
collision_layer = 5
script = ExtResource("1_dtymi")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
@ -1498,12 +1504,12 @@ parameters/melee/1/blend_position = Vector2(-0.218698, 0.0434783)
parameters/melee/2/blend_position = Vector2(0, 0)
parameters/walk/blend_position = Vector2(-0.0100167, -0.0729166)
[node name="Area2D" type="Area2D" parent="."]
[node name="Hitbox" type="Area2D" parent="."]
position = Vector2(0, 1)
collision_layer = 2
collision_mask = 2
collision_mask = 10
[node name="Hitbox" type="CollisionShape2D" parent="Area2D"]
[node name="Collider" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(0, -14)
shape = SubResource("CapsuleShape2D_vm050")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
@ -1511,3 +1517,16 @@ debug_color = Color(1, 0.133333, 0.321569, 0.419608)
[node name="MovementCollider" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, -1)
shape = SubResource("RectangleShape2D_bdqvd")
[node name="Attackbox" type="Area2D" parent="."]
position = Vector2(0, 1)
collision_layer = 8
collision_mask = 2
input_pickable = false
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
position = Vector2(8, -15)
shape = SubResource("CircleShape2D_md645")
debug_color = Color(0.745098, 0.462745, 0, 0.419608)
[connection signal="area_entered" from="Attackbox" to="." method="_on_attackbox_area_entered"]

View file

@ -6,6 +6,7 @@
size = Vector2(13, 8)
[node name="NemNPC" type="CharacterBody2D"]
y_sort_enabled = true
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1

BIN
Reed/Reed Walk Sprite Cycle Line .png (Stored with Git LFS)

Binary file not shown.

BIN
Reed/Reed Walk Sprite Cycle Line 2.png (Stored with Git LFS)

Binary file not shown.

BIN
Reed/Reed Walk Sprite Cycle Line Up.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://pittqsk5eskq"
path="res://.godot/imported/Reed Walk Sprite Cycle Line Up.png-b54613ce8bf766a99a03985f12dcc8d8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Reed/Reed Walk Sprite Cycle Line Up.png"
dest_files=["res://.godot/imported/Reed Walk Sprite Cycle Line Up.png-b54613ce8bf766a99a03985f12dcc8d8.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
Reed/Reed Walk Sprite Cycle Line.png (Stored with Git LFS)

Binary file not shown.

View file

@ -1,41 +0,0 @@
extends CharacterBody2D
@export var speed = 100
var last_dpad: Array[Vector2] = [Vector2.ZERO,Vector2.ZERO]
const FACING_ANGLE_EPSILON = 15
func _physics_process(_delta):
get_input()
move_and_slide()
func xor(a:bool, b:bool):
return a != b
func get_input():
var vertical = Input.get_axis("up", "down")
var horizontal = Input.get_axis("left", "right")
var input_direction = Vector2(horizontal, vertical)
var input_angle = rad_to_deg(atan2(vertical,horizontal))
var test = xor(abs(input_direction.dot(Vector2.RIGHT)) > 0.5, abs(input_direction.dot(Vector2.UP)) > 0.5)
# Keep lateral directions when moving diagonally
# if the player moves in one direction and then diagonally
# (i.e. first left then up-left)
if test or input_direction == Vector2.ZERO:
last_dpad[1] = last_dpad[0]
last_dpad[0] = input_direction
if last_dpad[0] == Vector2.ZERO and input_direction != Vector2.ZERO:
last_dpad[0] = input_direction
velocity = input_direction * speed
if input_direction == Vector2.ZERO:
$AnimationTree.set("parameters/conditions/is_moving", false)
else:
$AnimationTree.set("parameters/conditions/is_moving", true)
$AnimationTree.set("parameters/idle/blend_position", last_dpad[0])
$AnimationTree.set("parameters/walk/blend_position", last_dpad[0])
$AnimationTree.set("parameters/melee/0/blend_position", last_dpad[0])
$AnimationTree.set("parameters/melee/1/blend_position", last_dpad[0])

View file

@ -1,29 +1,10 @@
[gd_scene load_steps=31 format=3 uid="uid://bakb5a7xe4qby"]
[ext_resource type="Texture2D" uid="uid://cdj0xguv58xsh" path="res://Reed/Reed Walk Sprite Cycle Line 2.png" id="2_d0uyp"]
[ext_resource type="Texture2D" uid="uid://pittqsk5eskq" path="res://Reed/Reed Walk Sprite Cycle Line Up.png" id="1_3flg1"]
[ext_resource type="Script" path="res://Scripts/reed_player.gd" id="1_67bf4"]
[sub_resource type="GDScript" id="GDScript_0yk2k"]
script/source = "extends CharacterBody2D
@export var speed = 100
func _physics_process(_delta):
get_input()
move_and_slide()
func get_input():
var vertical = Input.get_axis(\"up\", \"down\")
var horizontal = Input.get_axis(\"left\", \"right\")
var input_direction = Vector2(horizontal, vertical)
velocity = input_direction * speed
if input_direction == Vector2.ZERO:
$AnimationTree.set(\"parameters/conditions/is_moving\", false)
else:
$AnimationTree.set(\"parameters/conditions/is_moving\", true)
$AnimationTree.set(\"parameters/idle/blend_position\", input_direction)
$AnimationTree.set(\"parameters/walk/blend_position\", input_direction)
"
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_u6r1x"]
height = 36.0
[sub_resource type="SpriteFrames" id="SpriteFrames_q4cow"]
@ -265,11 +246,19 @@ graph_offset = Vector2(-127, -15)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6r0cx"]
size = Vector2(13, 8)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_u6r1x"]
height = 36.0
[node name="ReedPlayer" type="CharacterBody2D"]
script = SubResource("GDScript_0yk2k")
y_sort_enabled = true
script = ExtResource("1_67bf4")
[node name="Area2D" type="Area2D" parent="."]
position = Vector2(0, 1)
collision_layer = 2
collision_mask = 2
[node name="Hitbox" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, -14)
shape = SubResource("CapsuleShape2D_u6r1x")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(-113, -88)
@ -278,7 +267,7 @@ sprite_frames = SubResource("SpriteFrames_q4cow")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -13)
texture = ExtResource("2_d0uyp")
texture = ExtResource("1_3flg1")
hframes = 20
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
@ -299,14 +288,5 @@ parameters/idle/blend_position = Vector2(-0.0599676, 0.460317)
parameters/walk/blend_position = Vector2(-0.531605, 0.407407)
[node name="MovementCollider" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, -1)
shape = SubResource("RectangleShape2D_6r0cx")
[node name="Area2D" type="Area2D" parent="."]
position = Vector2(0, 1)
collision_layer = 2
collision_mask = 2
[node name="Hitbox" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, -13)
shape = SubResource("CapsuleShape2D_u6r1x")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)

View file

@ -4,6 +4,8 @@ extends CharacterBody2D
var last_dpad: Array[Vector2] = [Vector2.ZERO,Vector2.ZERO]
const FACING_ANGLE_EPSILON = 15
signal attack_did_hit(other: Area2D)
func _process(_delta):
if Input.is_action_pressed("melee") and $AnimationTree.get("parameters/conditions/melee") == false:
var animation_rng = randf_range(0, 1)
@ -51,3 +53,7 @@ func get_input():
$AnimationTree.set("parameters/melee/0/blend_position", last_dpad[0])
$AnimationTree.set("parameters/melee/1/blend_position", last_dpad[0])
$AnimationTree.set("parameters/melee/2/blend_position", last_dpad[0])
func _on_attackbox_area_entered(area: Area2D):
attack_did_hit.emit(area)

View file

@ -4,35 +4,40 @@ extends CharacterBody2D
var last_dpad: Array[Vector2] = [Vector2.ZERO,Vector2.ZERO]
const FACING_ANGLE_EPSILON = 15
func _physics_process(_delta):
get_input()
move_and_slide()
func xor(a:bool, b:bool):
return a != b
#func _physics_process(_delta):
#get_input()
#move_and_slide()
#
#func xor(a:bool, b:bool):
#return a != b
#
#func get_input():
#var vertical = Input.get_axis("up", "down")
#var horizontal = Input.get_axis("left", "right")
#var input_direction = Vector2(horizontal, vertical)
#var input_angle = rad_to_deg(atan2(vertical,horizontal))
#
#var test = xor(abs(input_direction.dot(Vector2.RIGHT)) > 0.5, abs(input_direction.dot(Vector2.UP)) > 0.5)
#
## Keep lateral directions when moving diagonally
## if the player moves in one direction and then diagonally
## (i.e. first left then up-left)
#if test or input_direction == Vector2.ZERO:
#last_dpad[1] = last_dpad[0]
#last_dpad[0] = input_direction
#if last_dpad[0] == Vector2.ZERO and input_direction != Vector2.ZERO:
#last_dpad[0] = input_direction
#
#velocity = input_direction * speed
#
#if input_direction == Vector2.ZERO:
#$AnimationTree.set("parameters/conditions/is_moving", false)
#else:
#$AnimationTree.set("parameters/conditions/is_moving", true)
#$AnimationTree.set("parameters/idle/blend_position", last_dpad[0])
#$AnimationTree.set("parameters/walk/blend_position", last_dpad[0])
func get_input():
var vertical = Input.get_axis("up", "down")
var horizontal = Input.get_axis("left", "right")
var input_direction = Vector2(horizontal, vertical)
var input_angle = rad_to_deg(atan2(vertical,horizontal))
var test = xor(abs(input_direction.dot(Vector2.RIGHT)) > 0.5, abs(input_direction.dot(Vector2.UP)) > 0.5)
# Keep lateral directions when moving diagonally
# if the player moves in one direction and then diagonally
# (i.e. first left then up-left)
if test or input_direction == Vector2.ZERO:
last_dpad[1] = last_dpad[0]
last_dpad[0] = input_direction
if last_dpad[0] == Vector2.ZERO and input_direction != Vector2.ZERO:
last_dpad[0] = input_direction
velocity = input_direction * speed
if input_direction == Vector2.ZERO:
$AnimationTree.set("parameters/conditions/is_moving", false)
else:
$AnimationTree.set("parameters/conditions/is_moving", true)
$AnimationTree.set("parameters/idle/blend_position", last_dpad[0])
$AnimationTree.set("parameters/walk/blend_position", last_dpad[0])
func _on_player_attack_did_hit(other: Area2D):
if other.get_parent().get_instance_id() == get_instance_id() :
print(other.get_parent().name + " OUCHHHHH")

View file

@ -88,8 +88,9 @@ melee={
[layer_names]
2d_physics/layer_1="Movement"
2d_physics/layer_2="Attacks"
2d_physics/layer_2="Hitboxes"
2d_physics/layer_3="Triggers"
2d_physics/layer_4="Attacks"
[rendering]

View file

@ -2,8 +2,8 @@
[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"]
[ext_resource type="Script" path="res://Scripts/hiro_player.gd" id="3_ckn0m"]
[ext_resource type="Texture2D" uid="uid://b40la2vyf4rn6" path="res://world/Fighting Dojo BG.png" id="4_elb6q"]
[ext_resource type="Script" path="res://Scripts/reed_player.gd" id="5_df088"]
[ext_resource type="PackedScene" uid="uid://bakb5a7xe4qby" path="res://Reed/reed_player.tscn" id="6_cn8e2"]
[node name="Node2D" type="Node2D"]
@ -16,17 +16,12 @@ position = Vector2(136, 148)
texture = ExtResource("4_elb6q")
[node name="HiroPlayer" parent="." instance=ExtResource("1_c1gpq")]
y_sort_enabled = true
position = Vector2(92, 178)
script = ExtResource("3_ckn0m")
[node name="ReedPlayer" parent="." instance=ExtResource("6_cn8e2")]
y_sort_enabled = true
position = Vector2(176, 178)
script = null
[node name="NemNPC" parent="." instance=ExtResource("1_sqt7d")]
y_sort_enabled = true
position = Vector2(138, 112)
[node name="BG Collissions" type="StaticBody2D" parent="."]
@ -36,3 +31,11 @@ y_sort_enabled = true
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.238, 91.9084, 180.012, 107.053, 178.549, 113.823, 176.739, 116.426, 175.042, 118.083, 169.497, 118.319, 169.497, 123.525, 164.745, 123.525, 164.858, 118.319, 158.975, 117.846, 157.504, 116.663, 155.806, 114.533, 154.109, 108.617, 154.109, 94.4188, 154.222, 83.2968, 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.222, 83.7701, 155.92, 79.9839)
[node name="HiroDummy" parent="." instance=ExtResource("1_c1gpq")]
modulate = Color(0.603922, 0.603922, 0.603922, 1)
position = Vector2(139, 203)
script = ExtResource("5_df088")
[connection signal="attack_did_hit" from="HiroPlayer" to="ReedPlayer" method="_on_player_attack_did_hit"]
[connection signal="attack_did_hit" from="HiroPlayer" to="HiroDummy" method="_on_player_attack_did_hit"]