Actors spawning when other actors approach
Saltydog86
Member Posts: 5
Hello I have been dabbling with GS for a few months now working on a project in which I have a very solid design for. One issue I am running into is that I have a spawner that will spawn an actor every so many seconds. The goal of these actors is to attack an actor that I have sitting against the fall left side of the screen. (Side Scroller) I cannot for the life of me figure out how to get the actor to spawn the "bullet" its supposed to fire in which to protect itself.
I want the "bullet" to spawn whenever the invading actors get close enough. I have a semi working tracking system but I cannot get it to operate on its own without me either pressing a button or clicking my mouse. Any help would be greatly appreciated.
Comments
When magnitude (hero.x - attacker.x, hero.y - attacker.y) < distance . . . then spawn bullets.
Another approach is the simply make a large (invisible) 'detector' actor that surrounds the hero, and have a rule that says when attacker overlaps with this detector then spawn bullets.
Well I am curious about how both of those would be implemented. I never thought making an invisible character and tying them together would work let alone where to start.
For the equation where exactly in the Spawner would I apply the equation?
If you Google constrain actors gamesalad you'll find a bunch of posts and videos that explain how to do that.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank you