Merged with previous commit

This commit is contained in:
VoidTwo
2021-12-10 15:05:49 -06:00
3 changed files with 73 additions and 52 deletions

View File

@@ -10,66 +10,66 @@ var counter: int = 0
signal demon_boss_death
func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
velocity = Vector2.ZERO
if player and position.distance_to(player.position) > 1:
velocity = position.direction_to(player.position).normalized() * SPEED
var angle = position.angle_to_point(player.position)
if abs(angle) > PI/2:
$AnimatedSprite1.scale.x = -0.563
else:
$AnimatedSprite1.scale.x = 0.563
if hit == true:
if counter < 15:
if counter % 5 == 0:
$AnimatedSprite1.visible = false
else:
$AnimatedSprite1.visible = true
counter += 1
velocity = Vector2.ZERO
else:
hit = false
counter = 0
if player and position.distance_to(player.position) > 1:
velocity = position.direction_to(player.position).normalized() * SPEED
var angle = position.angle_to_point(player.position)
if abs(angle) > PI/2:
$AnimatedSprite1.scale.x = -0.563
else:
$AnimatedSprite1.scale.x = 0.563
if hit == true:
if counter < 15:
if counter % 5 == 0:
$AnimatedSprite1.visible = false
else:
$AnimatedSprite1.visible = true
counter += 1
velocity = Vector2.ZERO
else:
hit = false
counter = 0
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
$AnimatedSprite1.animation = 'Walk'
return
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Walk'
return
func _on_player_detector_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = null
$AnimatedSprite1.animation = 'Idle'
return
if body.is_in_group('player'):
player = null
$AnimatedSprite1.animation = 'Idle'
return
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group('player_weapon_1'):
health -= 1
hit = true
elif area.is_in_group('player_weapon_2'):
health -= 2
hit = true
if area.is_in_group('player_weapon_1'):
health -= 1
hit = true
elif area.is_in_group('player_weapon_2'):
health -= 2
hit = true
if health <= 0:
call_deferred('queue_free')
emit_signal("demon_boss_death")
return
if health <= 0:
call_deferred('queue_free')
emit_signal("demon_boss_death")
return
func _on_Player_Detector__Attack_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Attack'
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Attack'
func _on_Player_Detector__Attack_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Walk'
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Walk'

View File

@@ -26,5 +26,9 @@ func _on_NextArea_area_entered(area: Area2D) -> void:
func _on_Demon_Boss_demon_boss_death() -> void:
$Timer.start()
func _on_Timer_timeout() -> void:
get_tree().change_scene('res://GUI/Level Complete.tscn')
queue_free()

File diff suppressed because one or more lines are too long