Need help with asteroid movement

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • In an attempt to increase my skill level with C2 I am making my own version of the classic "Asteroids" and I need help with the asteroids. For one, I want them to spin while they are in space, and they do that but they do it way way outside of their origin. Second, I want them to float freely around the world and very slowly be attracted to me, the player, that's in the center. How do I make this happen? Also, How do I make them re-spawn?

  • You can set the origin point in the animation editor. On the left under the toolbar is a button with the target on it. It lets you move the origin point to the middle of your graphic, and can move frame to frame if you animate. (remember, if it is animated, you are only editing one frame, you can right click on it and have it set all the frames to match.)

    The origin is the coordinate location for the sprite as well, so you may have to adjust your calculations on spawning and such.

    On respawning, you have lots of choices. You can count picked sprites of that type, without actually filtering any to see how many exist, and if it's too few, spawn one.

    Or "On sprite destroyed" you could "wait" a few seconds, then spawn a replacement.

    Watch the player's score and have them spawn on key values.

    There are lots of ways to make them attracted to the player as well, but you almost need to be more specific, as that is a lot to cover.

    It could be an invisible sprite surrounding the player, and when the asteroid touching it, it turns slightly toward the player. (the longer it touches the further it turns.)

    Or it could always turn just slightly toward the player. (the bullet behavior speed would keep the angle changing, so it would appear to work like gravity.)

    There are also plugins for actual gravity points.

  • Woah, that's a lot of information. First off, is it the image point that it centers around? I gave it the spin behavior and not sure if that helps or not. Also, The bullets explode outside the asteroid, like there's a invisible box around it. i want to explode when it's touching the asteroid and I'm not sure what's going on there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You might want to do the basic beginner's guide to C2 which will show/teach you the basic workflow and the basics of how to work with C2.

    You would then see that your issue with a bounding collision box is because you haven't set correctly the collision polygon of your sprite.

    Then you might want then to also check my tutorial Asteroid in less than 100 events which will take you even a bit further.

    It will show you a few tricks about respawn and warp, different waves/levels of asteroids and more.

    You might also want to check the manual, especially the interface part which will answer some of your questions.

    Finally, once you'll have already gone through all this previous documentation you can check the "How do I FAQ" that has a lot of examples about different mechanics and technic stuff like "attracting objects one to another".

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