merge with main

This commit is contained in:
2021-12-07 20:21:41 -06:00
parent 05e04c7db9
commit 7d04c41d79
15 changed files with 203 additions and 204 deletions

View File

@@ -10,44 +10,44 @@ var health: int = 1
func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
velocity = Vector2.ZERO
if player:
if position.distance_to(player.position) < 40:
velocity = position.direction_to(player.position).normalized() * -SPEED
elif position.distance_to(player.position) > 41:
velocity = position.direction_to(player.position).normalized() * SPEED
if player:
if position.distance_to(player.position) < 40:
velocity = position.direction_to(player.position).normalized() * -SPEED
elif position.distance_to(player.position) > 41:
velocity = position.direction_to(player.position).normalized() * SPEED
velocity = move_and_slide(velocity)
return
velocity = move_and_slide(velocity)
return
func _on_player_detector_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
return
if body.is_in_group('player'):
player = body
return
func _on_player_detector_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = null
return
if body.is_in_group('player'):
player = null
return
func _on_projectile_timer_timeout() -> void:
if player:
var projectile: Node = creepy_hand.instance()
projectile.init($Sprite.global_position, player.position)
get_tree().get_current_scene().get_node('Projectiles').add_child(projectile)
return
if player:
var projectile: Node = creepy_hand.instance()
projectile.init($Sprite.global_position, player.position)
get_tree().get_current_scene().get_node('Projectiles').add_child(projectile)
return
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group('player_weapon_1'):
health -= 1
elif area.is_in_group('player_weapon_2'):
health -= 2
if area.is_in_group('player_weapon_1'):
health -= 1
elif area.is_in_group('player_weapon_2'):
health -= 2
if health <= 0:
call_deferred('queue_free')
return
if health <= 0:
call_deferred('queue_free')
return

View File

@@ -7,22 +7,22 @@ var velocity: Vector2 = Vector2.ZERO
func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
velocity = Vector2.ZERO
if player:
velocity = position.direction_to(player.position).normalized() * SPEED
if player:
velocity = position.direction_to(player.position).normalized() * SPEED
velocity = move_and_slide(velocity)
return
velocity = move_and_slide(velocity)
return
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
if area.get_parent().name == 'Player':
player = area.get_parent()
return
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
return
player = null
return