How do I track the position of an actor properly?
h.rashid13
Member Posts: 4
Currently, I have a timer that, every 0 seconds, sets a Game variable to the current position of my actor (both x and y). Then I have a mask that is supposed to track the actor with the constrain attribute.
However, when the actor moves to a certain point in the scene (3/4 of the way to the right or 3/4 of the way up), the mask starts to move differently. I have attached the project I was working on when this happened. The actor that the mask is supposed to track is Frank.
http://www.mediafire.com/download.php?jctxycwpjqmn8g0
However, when the actor moves to a certain point in the scene (3/4 of the way to the right or 3/4 of the way up), the mask starts to move differently. I have attached the project I was working on when this happened. The actor that the mask is supposed to track is Frank.
http://www.mediafire.com/download.php?jctxycwpjqmn8g0
Best Answer
-
beefy_clyro Posts: 5,394@h.rashid13
Whose a silly fella then?
Really easy fix ....
Ready .....
Move your mask actor off of the HUD layer, down onto the scrollable layer where Frank is
Answers
Then you can tap in to the game.xpos variable wherever you need.
Hope that helps,
- Thomas
I would probably go with what Thomas has said. So constrain the mask to game attributes and then constrain the actual character to the game attributes ...
Alternatively, you can cut out one set of constrains by unlocking the prototype into an instance (your character) and then you can constrain the players self.position to scene > Layers > Correct Layer > Mask
This can save you constraining the mask to game attributes
I tried out constraining the the mask to Game and constraining Game to the actor, but the mask is still exhibiting the odd movement.
If you tried to play the game, you'd notice that as you move right, the mask will suddenly move farther right than the actor. I feel as though gamesalad is not reading the actor's position correctly.
game.maskX to self.positionX of mask
game.maskY to self.positionY of mask
self.positionX to game.maskX in character
self.positionY to game.maskY in character
That would work fine .. unless you have some conflicting rules somewhere.
I went to look at your project but its in windows format and I dont have the converting method.
tried to export for mac
http://www.mediafire.com/download.php?e4jiasougjvalkd
- Thomas
- Thomas