Constrain actor to another actor.
As_Of_Latte
Member, BASIC Posts: 343
Can I constrain one actors position to the edge of a different actor? If so, does anyone know how this can be done?
Hope this makes sense and I appreciate any help in advance .
Comments
Sure, you just have to figure out where the edge is.
I would constrain the edge of the actor to two game level attributes, x and y, and then constrain the follower actor to the game level attributes.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
@Summation Nice, thank you! I'll give it a try right now.
Also this might be useful too:
http://forums.gamesalad.com/discussion/75220/fast-constrain-linkmachine-v2
@Socks Awesome! I was unaware of your past post (I should have done more research) but this is very helpful! Thanks you
No matter how big the actor is, the right edge of the actor is always:
(self.position.x) + ((self.size.width)/2))
an the left edge is:
(self.position.x) - ((self.size.width)/2))
This is a handy way of finding the edge because even if you change the size or position of the actor the game will calculate the x position of its edge for you.
Nice one, @noahb
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)