Level 1 implemented

Level 1 playable; more to be added
This commit is contained in:
Jane Cho
2021-12-08 03:05:02 -06:00
parent 6e4284a792
commit d6e7dd9db3
6 changed files with 86 additions and 33 deletions

View File

@@ -10,6 +10,7 @@ var position_tracker = 0.0
var player = null
var obstacle = null
var DisplayValue = 10
var health: int = 2
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@@ -47,7 +48,7 @@ func _on_Player_detect_body_exited(_body):
func _on_Star_detect_body_entered(body_star):
#print("obstacle entered")
#print(body_star.name)#Obstacle
if body_star.name == 'Star':
if 'Star' in body_star.name:
obstacle = body_star
timer.set_wait_time(DisplayValue)
timer.start()
@@ -63,3 +64,15 @@ func _on_Star_detect_body_exited(_body):
func _on_Timer_timeout():
#print("time out")
obstacle = null # Replace with function body.
func _on_Hitbox_area_entered(area: Area2D):
if obstacle: #when the enemy is vulnerable
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