HITBOX 360

This commit is contained in:
MarcEricMartel 2023-10-10 22:31:20 -04:00
parent 03d29aeddc
commit 1ca7e558e7
3 changed files with 15 additions and 12 deletions

View File

@ -84,9 +84,9 @@ func endAttack():
animatedSprite.play("default")
func receive_damage(dmg):
print(currentHp - dmg)
if !isAlive:
return
if currentHp - dmg <= 0:
currentHp = 0
call_deferred("die")

View File

@ -364,7 +364,6 @@ _data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.0153061, 183.158), 0.0, 0.0, 0
point_count = 3
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_p2hkm"]
height = 38.0
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_qykhm"]
radius = 16.0
@ -429,6 +428,7 @@ color = Color(1, 1, 1, 0.423529)
[node name="LvlUpSnd" type="AudioStreamPlayer2D" parent="."]
[node name="CharacterCollision" type="CollisionShape2D" parent="."]
position = Vector2(0, -4)
shape = SubResource("CapsuleShape2D_p2hkm")
[node name="AttackArea" type="Area2D" parent="."]
@ -436,28 +436,28 @@ collision_layer = 2
collision_mask = 2
[node name="Attack1CollisionR" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(3, -7)
position = Vector2(3, -4)
rotation = 1.5708
skew = 0.223402
shape = SubResource("CapsuleShape2D_qykhm")
debug_color = Color(0.956863, 0.203922, 0, 0.419608)
[node name="Attack1CollisionL" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(-3, -7)
position = Vector2(-3, -4)
rotation = 1.5708
skew = -0.169297
shape = SubResource("CapsuleShape2D_qykhm")
debug_color = Color(0.956863, 0.203922, 0, 0.419608)
[node name="Attack2CollisionR" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(25, -7)
position = Vector2(15, -3)
rotation = 1.5708
skew = 0.0837758
shape = SubResource("CapsuleShape2D_qykhm")
debug_color = Color(0.956863, 0.203922, 0, 0.419608)
[node name="Attack2CollisionL" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(-25, -7)
position = Vector2(-15, -3)
rotation = 1.5708
skew = -0.0837758
shape = SubResource("CapsuleShape2D_qykhm")

View File

@ -15,6 +15,7 @@ extends CharacterBody2D
@export var damage: int = 5
@export var maxAtks: int = 1
@onready var killcount: int = 0
@onready var currAtks: int = 0
@onready var anim: Node = get_node("Sprite")
@onready var cooldown: Node = get_node("Atk_cooldown")
@ -23,8 +24,8 @@ extends CharacterBody2D
@onready var hitanim: Node = get_node("Hit")
@onready var atk1l: Node = get_node("AttackArea/Attack1CollisionL")
@onready var atk1r: Node = get_node("AttackArea/Attack1CollisionR")
@onready var atk2l: Node = get_node("AttackArea/Attack2CollisionL")
@onready var atk2r: Node = get_node("AttackArea/Attack2CollisionR")
@onready var atk2l: Node = get_node("AttackArea/Attack2CollisionR")
@onready var atk2r: Node = get_node("AttackArea/Attack2CollisionL")
@onready var atkL: Node = atk1l
@onready var atkR: Node = atk1r
@ -36,11 +37,13 @@ func add_foe(foe):
list.append(foe)
func remove_foe(foe):
receive_exp(foe.expReward)
list.erase(foe)
killcount += 1
# Called when the node enters the scene tree for the first time.
func _ready():
setLevel(8)
setLevel(4)
atk1l.set_disabled(true)
atk1r.set_disabled(true)
atk2l.set_disabled(true)
@ -58,7 +61,7 @@ func _process(delta):
if is_dying:
pass
if abs(velocity.x) < 0.2 && abs(velocity.y) < 0.2 && !is_attacking:
if abs(velocity.x) < 1 && abs(velocity.y) < 1 && !is_attacking:
setAnimState("Idle")
elif !is_attacking:
setAnimState("Run")
@ -90,8 +93,8 @@ func _process(delta):
while velocity.length() > 100:
velocity.x *= 0.99
velocity.y *= 0.99
velocity.x *= 0.99
velocity.y *= 0.99
velocity.x *= 0.97
velocity.y *= 0.97
#velocity.x += x
#velocity.y += y