small boss progess
This commit is contained in:
parent
986c83ec8f
commit
3f9103b1c8
42 changed files with 769 additions and 54 deletions
|
|
@ -2,9 +2,11 @@ extends Node2D
|
|||
|
||||
@export var speed = 300;
|
||||
@export var spawn_points : Node2D
|
||||
@export var spawn_scene : PackedScene
|
||||
@export var anim_player : AnimationPlayer
|
||||
@export var movable : Node2D
|
||||
|
||||
var target_pos := Vector2(0, 0)
|
||||
@onready var marker : Sprite2D = $DangerRound
|
||||
@onready var claw : Claw = $DangerRound/Claw
|
||||
|
||||
enum s { Follow, Smash, Spawn, Laser}
|
||||
var state = s.Follow
|
||||
|
|
@ -29,12 +31,21 @@ func spawn_minions(times : int):
|
|||
points.shuffle()
|
||||
for i in range(times):
|
||||
var p = points[i].global_position
|
||||
await create_tween().tween_property(marker, "global_position", p, 1).finished
|
||||
await claw.pickup()
|
||||
await create_tween().tween_property(movable, "global_position", p, 1).finished
|
||||
anim_player.play("grab")
|
||||
await anim_player.animation_finished
|
||||
state = s.Follow
|
||||
|
||||
func spawn_enemies():
|
||||
for j in range(3):
|
||||
var enemy = spawn_scene.instantiate()
|
||||
enemy.global_position = movable.global_position
|
||||
add_child(enemy)
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
|
||||
func smash():
|
||||
await claw.smash();
|
||||
anim_player.play("smash")
|
||||
await anim_player.animation_finished
|
||||
if randf() < 0.7:
|
||||
state = s.Follow
|
||||
else:
|
||||
|
|
@ -52,4 +63,4 @@ func follow(delta : float):
|
|||
following = max_follow_time;
|
||||
|
||||
func move_to(pos : Vector2, delta : float):
|
||||
marker.global_position = marker.global_position.move_toward(pos, delta * speed)
|
||||
movable.global_position = movable.global_position.move_toward(pos, delta * speed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue