0 Favourites

Objects with perpetual movement

  • Hello again!

    Thanks again to everyone with the help on setting up the wall bouncing effect for my game. I've since added in a planet object and got it moving around the screen as well, but the problem is that as it bounces off the walls, it starts to gradually slow down. I'd like the planet objects (there will be more eventually) to move continuously at the same rate of speed.

    I've tried setting the friction to 0 and played around with other settings in the physics behavior and I can't seem to figure it out. I also tried adding the bullet behavior to the object but that just made it somehow pass through the solid walls at the edge of the screen, so that approach didn't seem to work either. Help is greatly appreciated. I can post a link to a capx if it's needed.

  • posting a capx or a simplified capx to show the problem will always help

  • Sure thing! And to add, I've tried modifying all of the physics behavior setting on both the planet and sidewall objects, and it continues to slow down and eventually stop.

    dl.dropbox.com/u/8938070/PegJam/gametest.capx

    (I can't post actual links yet, unfortunately.)

  • Any ideas so far? :)

  • Try setting the elasticity to 1.

  • Fantastic! Thank you ramones! That works perfectly!

  • Hmm, after some further testing this doesn't quite work. It does cause the planet to bounce around for much longer so it's good for the time being, but ultimately I'd like to be able to figure out how to have the planet move at a constant speed like the asteroids in "Asteroids", and other games like that. The game takes place in space so there the objects should never slow down, so there seems to be something I'm missing about how physics objects work in C2.

  • What do you want to happen if the ship hits the planet? I can push it around until it stops. If you don't want it to ever stop, or be moved by the ship, I'd give the bullet movement a go combined with the physics. This will allow the planet to move the ship, but may result in some unusual 'crushing' behaviour.

  • Eventually the ship will be destroyed if it comes into contact with the planet, like in Asteroids. I tried adding the bullet movement, but it causes the planet to pass right through the walls around the endges of the screen rather than bounce off of them.

  • Did you give the walls solid behavior and set the planet to bounce off solids?

  • On you very last event, When planet is on collision with side wall,

    Have you tried

    "applying impulse towards position".

    If you set the impulse to 5 and the X to 50 it kinda gives what you want, I think. I can try a bit later to think of a better way unless you have already found out how to.

    Hmm, after some further testing this doesn't quite work. It does cause the planet to bounce around for much longer so it's good for the time being, but ultimately I'd like to be able to figure out how to have the planet move at a constant speed like the asteroids in "Asteroids", and other games like that. The game takes place in space so there the objects should never slow down, so there seems to be something I'm missing about how physics objects work in C2.

  • This should work

    Did you give the walls solid behavior and set the planet to bounce off solids?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Retrodude, I'll try your suggestion. Setting the walls as solid etc. does not work however. The planet will gradually slow down and then stop.

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