How to Record Position of an Actor
agbeyeid
Member Posts: 18
in Help Wanted
I need to help record the position of actor so I can spawn another actor when the first actor gets to a particular position
Comments
Create two real game attributes and name them positionX and positionY. Inside your actor that you want to monitor, use two constrain attribute behaviors to constrain positionX to self.position.X and positionY to self.position.Y.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Another option is to just check the position within the actor since you already have access to its self.Position.X (and Y) attributes:
When attribute self.Position.X = ___ AND attribute self.Position.Y = ___
Spawn actor [actor name]
Keep in mind that depending on how you are moving and stopping the actor, the rule conditions may not ever be true (e.g. self.Position.X might end being 249.988 instead of 250). You can also use ≤ or ≥ in a rule condition. Or you can round the attribute to a whole number... lots of ways to skin this turkey.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
A third option would be to place an invisible actor at the particular position and use this to trigger the spawn once the other actor collides with it.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@jamie_c Even better!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks for the suggestions.