blocks now break upon colliding once their health is depleted
This commit is contained in:
+5
-4
@@ -10,8 +10,8 @@ var _velocity: Vector2
|
||||
var deg: float
|
||||
|
||||
func _ready():
|
||||
_velocity.x = 200#speed * _speed_mult * _direction.x * delta
|
||||
_velocity.y = 250#speed * _speed_mult * _direction.y * delta
|
||||
_velocity.x = 400#speed * _speed_mult * _direction.x * delta
|
||||
_velocity.y = 450#speed * _speed_mult * _direction.y * delta
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
@@ -23,9 +23,10 @@ func _physics_process(delta):
|
||||
_invert_x()
|
||||
if (deg >= 135 and deg < 225) or deg < 45 or deg >= 315:
|
||||
_invert_y()
|
||||
if collide.get_collider() is Block:
|
||||
print(collide.get_collider())
|
||||
if collide.get_collider().get_parent() is Block:
|
||||
print(true)
|
||||
collide.get_collider().take_damage(strength)
|
||||
collide.get_collider().get_parent().take_damage(strength)
|
||||
|
||||
func _invert_x():
|
||||
_velocity.x *= -1
|
||||
|
||||
Reference in New Issue
Block a user