AI now has health and can die
This commit is contained in:
parent
880a0304c3
commit
344cf5649f
6 changed files with 11 additions and 5 deletions
|
@ -30,7 +30,7 @@ func _physics_process(delta):
|
|||
self.queue_free()
|
||||
elif body.is_in_group("AI"):
|
||||
print("Bullet hit an AI player")
|
||||
body.queue_free()
|
||||
Global.AIHit = true
|
||||
self.queue_free()
|
||||
else:
|
||||
print("Bullet hit something else")
|
||||
|
|
|
@ -31,7 +31,6 @@ offset_left = 245.0
|
|||
offset_top = 577.0
|
||||
offset_right = 436.0
|
||||
offset_bottom = 640.0
|
||||
tooltip_text = "Coming soon"
|
||||
text = "TUTORIAL"
|
||||
|
||||
[node name="playButton" type="Button" parent="."]
|
||||
|
@ -123,7 +122,7 @@ offset_left = 4.0
|
|||
offset_top = 622.0
|
||||
offset_right = 94.0
|
||||
offset_bottom = 648.0
|
||||
text = "Version: PLAYTEST 20230318"
|
||||
text = "Version: ALPHA"
|
||||
|
||||
[node name="OurTimeIsNowSolo" type="Sprite2D" parent="."]
|
||||
position = Vector2(123, 104)
|
||||
|
|
|
@ -3,6 +3,7 @@ extends CharacterBody3D
|
|||
|
||||
const SPEED = 3.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
var health = 100
|
||||
|
||||
var bullettimer = 50
|
||||
var bulletshot = false
|
||||
|
@ -31,6 +32,13 @@ func _physics_process(delta):
|
|||
if $CollisionShape3D/Neck/Teddy/AnimationPlayer.is_playing() == false and not Global.tutorialComplete:
|
||||
$CollisionShape3D/Neck/Teddy/AnimationPlayer.play("idle")
|
||||
if player and Global.playerAlive and Global.tutorialComplete:
|
||||
if Global.AIHit == true:
|
||||
Global.AIHit = false
|
||||
var damage = RandomNumberGenerator.new().randi_range(7, 16)
|
||||
health -= damage
|
||||
print(health)
|
||||
if health <= 0:
|
||||
self.queue_free()
|
||||
if $CollisionShape3D/Neck/Teddy/AnimationPlayer.is_playing():
|
||||
var animation = $CollisionShape3D/Neck/Teddy/AnimationPlayer.get_current_animation()
|
||||
if animation == "idle":
|
||||
|
|
|
@ -43,6 +43,7 @@ var spawnCoords_z: Array[float] = [] # Used locally in spawn_locations() functio
|
|||
var spawnCoordsInitalized = false # Used locally
|
||||
var volumeModifer = 1 # Modifies volume level
|
||||
var tutorialComplete = false # Used only for tutorial
|
||||
var AIHit = false # Used so the AI knows to take damage
|
||||
|
||||
func _process(delta):
|
||||
#if not spawnCoordsInitalized:
|
||||
|
|
|
@ -46,7 +46,6 @@ func _process(delta):
|
|||
else:
|
||||
print("This shouldn't ever be called, toyland.gd")
|
||||
Global.musicUpdated = true
|
||||
print("hehe")
|
||||
|
||||
|
||||
func play_music(music):
|
||||
|
|
|
@ -46,7 +46,6 @@ func _process(delta):
|
|||
else:
|
||||
print("This shouldn't ever be called, toyland.gd")
|
||||
Global.musicUpdated = true
|
||||
print("hehe")
|
||||
|
||||
|
||||
func play_music(music):
|
||||
|
|
Loading…
Reference in a new issue