How do I keep momentum through a wrap?

0 favourites
  • 7 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • I'm working on a basic 'asteroids' clone, and I've hit a snag with the wrap behavior. When the ship (I'm only as far as the ship and its movement mechanics atm) crosses the edge, it comes to a complete stop- advancing as normal across the edge and onto the other side of the screen from there if you keep holding the accelerator. This seems to be because I'm using the Physics behavior for my movement; I've noticed that using 'custom movement' like they do in the demo works fine. All the same, I wonder if there's a way to use the physics behavior with wrap without losing all momentum at the edge of the screen.

    PS: sorry, but I can't include a .capx of the project. I'm currently trying to resolve a problem I'm having where Construct 2 refuses to save to that format.

  • Dont use the wrap ? Use two inmovable physics objects to mark the bondarys?

  • Well, yeah; but what if I actually want the wrap behavior, but on an object whose movements are governed by the physics behavior? It seems like there should be a way to do that, but being quite new to this I have no idea what it might be.

  • Well, yeah, actualy that is a foolish wish. (excuse the word). You have to stay in the context.

    You move the objects with physics, then you got to change its motions with physics. Stopping it = changing its motion.

    Any other way will break the physics world.

    Because the physics world depends on tweening little changes that happen in little steps over time. Every action has a reaction. Nothing, absolutly nothing can change position in zero time, that would be magic and break the physics world.

    If you change things in zero time. You are in the quantum world. (or in some Fairy World) With totaly differend rules. As you know, both worlds are not compatible (yet).

  • I think I get that much of it; but surely there is some way to get an object governed by the physics behavior which exits one side of the screen to enter on the other side moving at the same speed and angle as it had left. But I if I understand you, what you're saying is that there's no shortcut to get that effect, and if I want that to happen I'll actually have to set up a function to do it myself rather than be lazy and use Scirra's fancy pre-packaged screen wrap?

    Being the lazy dude I am, I was hoping to avoid having to do that; but I'm not all that surprised to hear it. Either way this is going to go way faster than coding it by hand. Thanks for the help. ^_^

    PS: My first instinct is to have sprites whose center hits the edge reassign their position to the corresponding position on the opposite edge; is that how you'd go about it, or is there a better way?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have not seen one wrap a physics object yet.

    I suppose the solution is in this direction, since wrap dont have a 'on wrap' condition.

    https://drive.google.com/open?id=0B1SSu ... 3NpQTlEeWM

    Overlap = just lazy. Can do it with abs(distance from center of the window) too. But it would not be a visual example.

  • Ok; that makes perfect sense. I hadn't considered using other sprites as a way to define the wrap. Thank you for your help; this should be useful for a number of things beyond screen wrapping.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)