Update test project for Godot 4.3 (#159)
Co-authored-by: Andi Susanto <and1zero@users.noreply.github.com> Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
10
test-project/scripts/EnemyGenerator.gd
Executable file → Normal file
10
test-project/scripts/EnemyGenerator.gd
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
extends Node2D
|
||||
|
||||
onready var EnemyScene: PackedScene = preload("res://scenes/Projectile.tscn")
|
||||
@onready var EnemyScene: PackedScene = preload("res://scenes/Projectile.tscn")
|
||||
signal start
|
||||
signal stop
|
||||
|
||||
@@ -11,16 +11,16 @@ func _ready():
|
||||
self.emit_signal("stop")
|
||||
|
||||
func setup_enemy() -> void:
|
||||
self.Enemy = EnemyScene.instance()
|
||||
Enemy.setup(GLOBAL.MISSILE, GLOBAL.MISSILE_SPEED["max"])
|
||||
self.Enemy = EnemyScene.instantiate()
|
||||
Enemy.setup(GLOBAL.SpriteType.MISSILE, GLOBAL.MISSILE_SPEED["max"])
|
||||
|
||||
func spawn_and_shoot_enemy() -> void:
|
||||
var Duplicate = Enemy.duplicate(Node.DUPLICATE_USE_INSTANCING)
|
||||
var Duplicate = Enemy.duplicate(Node.DUPLICATE_USE_INSTANTIATION)
|
||||
Duplicate.set_random_color()
|
||||
Duplicate.update_collision_layer()
|
||||
$Enemies.add_child(Duplicate)
|
||||
|
||||
$SpawnArea/SpawnLocation.set_offset(randi())
|
||||
$SpawnArea/SpawnLocation.set_h_offset(randi())
|
||||
Duplicate.global_position = $SpawnArea/SpawnLocation.position
|
||||
|
||||
var direction: Vector2 = (Vector2(0, 1080) - Duplicate.global_position).normalized()
|
||||
|
||||
Reference in New Issue
Block a user