Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | congbinh75 |
I’m learning to make a space shooter game on Godot.
I’m working on spawning enemies on stage follow a plan which decides which enemy will be spawned and when they spawn. But I’ve searched and tried several methods but it didn’t work. You guys have any solution for me ? I’m just new to programming and this engine.
Thanks in advance !
Edit:
I posted this question because Im having an issue with method used in Your First Game tutorial. I plan to do the similar way in the tutorial but I will decide where and when an enemy come up, not randomly spawning.
First, I tried to spawn one scene of enemy (consists of 8 smaller scene) repeatedly when ever the “timeout” signal emits. But the scene just appeared on the screen once and didn’t appear again. (I’m sure that the Timer is autostart and not one shot.)
This is the stage’s scripts:
extends Node2D
var aship = preload("res://elements/elements/e_enemy_alpha.tscn")
export (PackedScene) var enemy
func _ready():
pass
func _on_Timer_timeout():
var e = enemy.instance()
add_child(e)
pass
Hi, you should share what you got till now so we can help. For example what you already tryed and the results you obtained.
The way mobs are spawn in “Your First Game” tutorial isn’t enough for your case?
p7f | 2019-01-22 17:00
Thanks for your reply! I’ve added some edit with my issues with the stage’s scripts above.
congbinh75 | 2019-01-23 05:52
The code seems right to me… could you share me the project so i can test what ia happening?
p7f | 2019-01-23 11:00
I haven’t known how to use Github yet so can you download it from Google Drive ?
My Project
congbinh75 | 2019-01-24 09:01
I’ll have a look. What version of godot are you using?
p7f | 2019-01-24 11:38
Hi,
The enemies DO spawn, but for some reazon the don’t move and stay out of the window. Let me see if i find something more.
p7f | 2019-01-24 12:07