Transitions and display objects?

Hi All,

the transition.to function should transition a display group, correct? I have a transition that works fine when I’m just transitioning a single display object (a rectangle). As soon as I add that object to a group and then try to transition the group, the transition no longer works. Any thoughts

Also, am I correct in saying that transitions do not work with the physics library? I had been using a transition to move an object with physics properties and it does not retain them once I’ve started moving it.

Thanks for any insight you can share :slight_smile: [import]uid: 105707 topic_id: 32866 reply_id: 332866[/import]

Hi there,

Yes, transition.to can transition display groups. To better understand why it’s not working in your case, it would be helpful if you posted code for a simple example that exhibits the issue.

On your second question, you said “does not retain them” – you’re referring to the physics properties of the object (e.g., angularVelocity)? As far as I know, those properties wouldn’t/couldn’t be lost. However, I wouldn’t recommend using transition.to on physics bodies, since the physics engine “owns” the behavior and movement of the body, and running a transition.to will try to “fight” it with potentially unexpected results.

  • Andrew [import]uid: 109711 topic_id: 32866 reply_id: 130660[/import]

Hi there,

Yes, transition.to can transition display groups. To better understand why it’s not working in your case, it would be helpful if you posted code for a simple example that exhibits the issue.

On your second question, you said “does not retain them” – you’re referring to the physics properties of the object (e.g., angularVelocity)? As far as I know, those properties wouldn’t/couldn’t be lost. However, I wouldn’t recommend using transition.to on physics bodies, since the physics engine “owns” the behavior and movement of the body, and running a transition.to will try to “fight” it with potentially unexpected results.

  • Andrew [import]uid: 109711 topic_id: 32866 reply_id: 130660[/import]

Hi Andrew,

I appreciate the input.

I’ve discovered that apparently to transition a display group and have it render correctly, you have to have more than one display object in the group. I had been building a test set up and only had a singular object in each of my display groups. As soon as I added more, they worked correctly.

As far as “retaining” physics properties, I had really meant the collision properties of the tiles I’m moving. I have tiles that I’m using as “walls” in my game and once I move them with a transition.to, they no longer keep their collision (you can move through them). You make a good point about not using transitions and physics. Should I try to move the objects with their .x and .y properties incrementally per frame?

This idea has me thinking about how to scroll a screen (a “top-down” perspective) to move a player around a map/level that’s bigger than the display. I presume that a person would assign all map/NPC/object tiles to a group and shift that via .x and .y as appropriate when the player approached the edge of the display in order to get a panning effect?

Thanks [import]uid: 105707 topic_id: 32866 reply_id: 130695[/import]

Perspective

This is an extremely easy to use camera library I made.

And, as to the transitions and physics:
First of all, just incrementing the x and y is what a transition is. So, that’s no better. If you’re looking for a physics movement, I’d say linear velocity should do it. However, I’ve been transition-ing objects with physics and I can’t see any problem. [import]uid: 147322 topic_id: 32866 reply_id: 130702[/import]

Hi Andrew,

I appreciate the input.

I’ve discovered that apparently to transition a display group and have it render correctly, you have to have more than one display object in the group. I had been building a test set up and only had a singular object in each of my display groups. As soon as I added more, they worked correctly.

As far as “retaining” physics properties, I had really meant the collision properties of the tiles I’m moving. I have tiles that I’m using as “walls” in my game and once I move them with a transition.to, they no longer keep their collision (you can move through them). You make a good point about not using transitions and physics. Should I try to move the objects with their .x and .y properties incrementally per frame?

This idea has me thinking about how to scroll a screen (a “top-down” perspective) to move a player around a map/level that’s bigger than the display. I presume that a person would assign all map/NPC/object tiles to a group and shift that via .x and .y as appropriate when the player approached the edge of the display in order to get a panning effect?

Thanks [import]uid: 105707 topic_id: 32866 reply_id: 130695[/import]

Perspective

This is an extremely easy to use camera library I made.

And, as to the transitions and physics:
First of all, just incrementing the x and y is what a transition is. So, that’s no better. If you’re looking for a physics movement, I’d say linear velocity should do it. However, I’ve been transition-ing objects with physics and I can’t see any problem. [import]uid: 147322 topic_id: 32866 reply_id: 130702[/import]