Problem with actor position
tiesto
Member Posts: 122
Hello.
So like in the title I have a problem with an actor. So my actor (1) is in a HUD layer, it has a control camera and it moves to the up.
I have an other actor (2) in up of the screen outside the camera and in an other layer not a HUD. I put a rule that said when my actor (1) collide with the second actor (2) the actor (2) destroy. But it doesn't work, I don't know what to do.
If you can help me.
Thank you.
Comments
That is going to throw things off as the hud freezes that actors scene location so technically they don't collide aka occupy the same position. Put a display text in both actors and see the positions.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
and what can I do to make them collide knowing that I want to leave my actor in the HUD layer
I don't believe that is possible
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Consider using an invisible actor in the same layer that is constrained to the position of the actor in the other layer and then set a collision rule on the invisible actor. You'll need to change the value of a game attribute (e.g. a boolean) and have the #2 actor destroy itself when that attribute has changed.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I tried that but it does not. After a while the second player does not have the same position as the first.
Actors on scrollable layers do not collide properly with actors on un-scrollable ones. See this bug: http://bugs.gamesalad.com/show_bug.cgi?id=1368
One workaround may be to contain your actor's position rather than put it into an un-scrollable layer.
I'm not sure what that means...
Then you're not constraining the attributes correctly. Post a screenshot of your rule(s) and we'll see what we can figure out. You'll need to upload the images to a file-sharing site first and then post the link(s) here.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang here is the screenshot of my rules of my first actor in HUD layer : http://hpics.li/237ce59
and the second actor : http://hpics.li/15d5081
That will not work at all. You are either not listening or don't understand. let me try to explain it again.
hud actors, even though it appears they are moving down the scene, code wise they are not. so an actor set on say an iPad layout in horizontal will only see a range on the X axis of 0-1024 pixels period. As this is the purpose of a non-scrollable layer. So if actor two's position is greater than 1024 in theory code wise they will never collide as actor one can't recognize anything past 1024 pixels.
it is impossible to work around this as it is part of the hud mechanics and not a bug. if non-scrollable layers could then they wouldn't be non-scrollable layers anymore. Since we do not have two cameras in Gamesalad this is not possible to work around.
What you would need to do is track the camera position and build an algorithm that extrapolates the current hud position and measures actor1's position in the hud in relation to the current scene area and actor2's position. not an easy task but could be done.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I had a similar problem. Slightly different as I'm checking for an actor to be on the whole screen. Still, my solution is similar to what's mentioned here. This might help...
forums.gamesalad.com/discussion/89545/camera-offset-problem?new=1