Stopping spawned characters...?
allc1865
Member, PRO Posts: 777
How would I stop spawned characters at a certain point. So, the spawned enemies are coming at the player, but I want them to stop a certain distance from the player and still shoot at him. Any ideas would be great. Thanks
Best Answer
-
jamie_c ImagineLabs.rocks Posts: 5,772Here's an update for you. I turned off your check of the magnitude and just used the enemies Y location to allow or stop movement. Check it out:
Answers
If your game is like space invaders and your player is always 'locked' at a Y coordinate of 50, you could tell your enemies not to move past the Y point of 100 with a rule like:
if (enemies) Y location is greater than 100, move the enemy closer.
But if your game is more complex and the player moves all around you'd probably need to use the Magnitude Function to keep track of the distance between the player and enemies.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I have that set up, but the last rule on the enemy: attribute > self.distanceFrom is less that 150 > accelerate towards...I want him to stop accelerating or spawning, which I'm not sure how to do...
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
Can you post your rules?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
https://www.dropbox.com/s/x3ulcfxk23anebx/enemies spawn and shoot .zip
Thanks, guys
Just a quick thought: If I wanted him to stop coming from the side, I would just use his X location?
If you are only concerned with stoping your enemies from moving in the X OR Y direction, I think the previous sample is fine.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thank you very much
I guess I just have another question. I have a minimap in my game, and I placed the rules from the template you gave me into my game, and the enemies aren't shooting anymore. I've tried to figure this out myself, though, but I'm not sure what the problem is.
I think it's because I have constrain attributes in the dots on the map; that may be messing with the enemies.
https://www.dropbox.com/s/p6tp39255s3yz8e/My actor game.zip
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thanks.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thanks for all your time ! :-bd