Level Functionality Complete

This commit is contained in:
tiffanyfrias10
2021-12-06 19:25:29 -06:00
parent f774ea1741
commit 8d119ff0c9
7 changed files with 85 additions and 23 deletions

View File

@@ -3,6 +3,8 @@ extends KinematicBody2D
export var ACCELERATION: int = 1000
export var MAX_SPEED: int = 120
export var FRICTION: int = 1000
signal frozen
const HEALTH_SLICES: Array = [0, 18, 35, 50, 65, 82, 100]
var health_index: int = 6
@@ -104,6 +106,9 @@ func _on_hitbox_area_entered(area: Area2D) -> void:
hit = 2
elif area.is_in_group('enemy_hitbox_3') or area.is_in_group('enemy_projectile_3'):
hit = 3
elif area.is_in_group('freeze'):
emit_signal('frozen')
modulate = Color(0,.5,1)
else:
return
#var timer = Timer.new()
@@ -151,11 +156,12 @@ func _input(event: InputEvent) -> void:
func _on_Hitbox_area_entered(area: Area2D) -> void:
print(area.name)
if area.name.begins_with("coin"):
print("COIN")
if area.name == 'detection':
return
if 'freeze' in area.get_parent().get_groups():
emit_signal('frozen')
return
if 'enemies' in area.get_parent().get_groups() or area.name != 'detection' or 'damage' in area.get_groups():
if health_index != 0:
@@ -164,3 +170,7 @@ func _on_Hitbox_area_entered(area: Area2D) -> void:
else:
get_tree().change_scene('res://Levels/Hub World.tscn')
return
func _on_SlowTime_unfreeze() -> void:
modulate = Color(1,1,1)

View File

@@ -182,7 +182,9 @@ graph_offset = Vector2( -3591.37, -302.6 )
[sub_resource type="AnimationNodeStateMachinePlayback" id=14]
[node name="Player" type="KinematicBody2D" groups=["player"]]
[node name="Player" type="KinematicBody2D" groups=[
"player",
]]
collision_layer = 2
script = ExtResource( 1 )
@@ -198,10 +200,12 @@ visible = false
rotation = 1.5708
shape = SubResource( 2 )
[node name="Hitbox" type="Area2D" parent="." groups=["player_hitbox"]]
[node name="Hitbox" type="Area2D" parent="." groups=[
"player_hitbox",
]]
input_pickable = false
collision_layer = 2
collision_mask = 4
input_pickable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
visible = false