merge with main

This commit is contained in:
2021-12-08 23:06:13 -06:00
106 changed files with 1735 additions and 1277 deletions

View File

@@ -9,58 +9,58 @@ var health: int = 2
func _physics_process(delta: float) -> void:
move = Vector2.ZERO
move = Vector2.ZERO
if player != null:
move = position.direction_to(player.position) * speed
else:
move = Vector2.ZERO
if player != null:
move = position.direction_to(player.position) * speed
else:
move = Vector2.ZERO
move = move.normalized()
move = move_and_collide(move)
move = move.normalized()
move = move_and_collide(move)
func _on_Area2D_body_entered(body: Node) -> void:
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = body
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = body
func _on_Area2D_body_exited(body: Node) -> void:
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = null
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = null
func fire():
var snowball = SNOWBALL_SCENE.instance()
snowball.position = get_global_position()
snowball.player = player
get_parent().add_child(snowball)
$Timer.set_wait_time(1)
var snowball = SNOWBALL_SCENE.instance()
snowball.position = get_global_position()
snowball.player = player
get_parent().add_child(snowball)
$Timer.set_wait_time(1)
func _on_Timer_timeout() -> void:
if player != null:
fire()
if player != null:
fire()
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
return
if area.get_parent().name == 'Player':
player = area.get_parent()
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
return
player = null
return
func _on_hitbox_area_entered(area: Area2D) -> void:
print("HIT")
if area.is_in_group('player_weapon_1'):
health -= 1
elif area.is_in_group('player_weapon_2'):
health -= 2
print("HIT")
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