Compare commits

...

3 commits

8 changed files with 2266 additions and 3529 deletions

File diff suppressed because it is too large Load diff

2113
Hiro/hiro_anims.tres Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
extends CharacterBody2D
@export var health = 100
@export var can_move = true
signal got_hurt(damage: int, attack_direction: Vector2)
signal defeated

View file

@ -1,14 +1,33 @@
extends CharacterBody2D
enum Heading {
north,
east,
west,
south
}
const HEADINGS = [Vector2.UP, Vector2.RIGHT, Vector2.LEFT, Vector2.DOWN]
@export var speed = 100
@export var initial_heading = Heading.south
@export var can_move = true
var last_dpad: Array[Vector2] = [Vector2.ZERO,Vector2.ZERO]
const FACING_ANGLE_EPSILON = 15
signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2)
signal defeated
func _process(_delta):
if Input.is_action_pressed("melee") and $AnimationTree.get("parameters/conditions/melee") == false:
func _ready() -> void:
$AnimationTree.set("parameters/idle/blend_position", HEADINGS[initial_heading])
$AnimationTree.set("parameters/walk/blend_position", HEADINGS[initial_heading])
$AnimationTree.set("parameters/melee/0/blend_position", HEADINGS[initial_heading])
$AnimationTree.set("parameters/melee/1/blend_position", HEADINGS[initial_heading])
$AnimationTree.set("parameters/melee/2/blend_position", HEADINGS[initial_heading])
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("melee") and can_move:
var animation_rng = randf_range(0, 1)
$AnimationTree.set("parameters/melee/blend_position", animation_rng)
$AnimationTree.set("parameters/conditions/melee", true)
@ -24,7 +43,6 @@ 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)
@ -37,10 +55,10 @@ func get_input():
if last_dpad[0] == Vector2.ZERO and input_direction != Vector2.ZERO:
last_dpad[0] = input_direction
if $AnimationTree.get("parameters/conditions/melee") ==true:
if not can_move:
input_direction = Vector2.ZERO
last_dpad[0] = Vector2.ZERO
last_dpad[1] = Vector2.ZERO
# last_dpad[0] = Vector2.ZERO
# last_dpad[1] = Vector2.ZERO
velocity = input_direction * speed

View file

@ -38,6 +38,6 @@ const FACING_ANGLE_EPSILON = 15
#$AnimationTree.set("parameters/walk/blend_position", last_dpad[0])
func _on_player_attack_did_hit(other: Area2D):
func _on_player_attack_did_hit(other: Area2D, _power: int, _direction: Vector2):
if other.get_parent().get_instance_id() == get_instance_id() :
print(other.get_parent().name + " OUCHHHHH")

View file

@ -12,7 +12,7 @@ config_version=5
config/name="Anthro Kai Game Prototype"
run/main_scene="res://world/world.tscn"
config/features=PackedStringArray("4.2", "Mobile")
config/features=PackedStringArray("4.3", "Mobile")
config/icon="res://icon.svg"
[display]
@ -34,16 +34,16 @@ ui_right={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
, null, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, null, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ui_text_caret_left={
@ -56,31 +56,31 @@ ui_text_caret_right={
}
up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":true,"script":null)
]
}
down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":true,"script":null)
]
}
right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":true,"script":null)
]
}
left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":true,"script":null)
]
}
melee={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
]
}

View file

@ -17,6 +17,7 @@ texture = ExtResource("4_elb6q")
[node name="HiroPlayer" parent="." instance=ExtResource("1_c1gpq")]
position = Vector2(92, 178)
can_move = true
[node name="ReedPlayer" parent="." instance=ExtResource("6_cn8e2")]
position = Vector2(176, 178)