How do I create sprites that follow walls/the ceiling?

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hey,

    I'm looking to make a sprite that follows the walls, floor, and ceiling (with the solid behavior) - that is, one that circles around landforms. I'm trying to do this without using external triggers that alter the direction of the sprite, as the landforms have the potential to change via adding blocks to them. See the image below for an example of what I'm looking for:

    Right now I have it semi-working by using a bunch of "is overlapping at offset" commands, but this is very iffy and the sprites periodically fall off of the wall and float out into oblivion.

    Can anyone think of a failproof way to make this work? I would be extremely grateful. Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well, this is a sample I made for someone over a year ago, but it uses external triggers... maybe it will give you some ideas.

    how fast do the objects move? how close do they need to be to the surface? how square are the land forms? are the objects thin like a person walking, or wide like a car or tank? Rotate as they go around? How do the new land forms appear? slide out of existing ones? or fall down? just appear? Do the objects just stick to the surface or does gravity hold them down?

    It is definitely going to be tricky to do it without external triggers... and have it be failproof.

  • Thanks for the sample, but yeah, those "GravityZone"-like sprites wouldn't really be possible in my case since the playing field is dynamic.

    In regards to your questions: the speed of the objects is set to about 60, but they could go as fast as ~250ish. They should be reasonably close to the surface (within 5-10 pixels). The objects are about 24x24 pixels, whereas the rest of the tiles are 32x32. They don't necessarily need to rotate as they go around corners. The new landforms appear out of thin air (you create them by clicking). Finally, the objects are held down by gravity (when they're on the floor; when they're following the ceiling, the gravity is set to 0).

    If you (or anyone else) can think of anything that might work with that information, I'm all ears. Thanks again.

  • Here's one possible way that could give you ideas.

    It solves the cornering in an exact way by positioning the detectors relative to the object's rounded position as I recall.

  • This is exactly what I need. It relies on the walls themselves, which is perfect. I'll have to play with this a bit.

    Thank you!

  • This is very simple, just create variable time and every (a) amount of time the object moves (x) or (y) along the layout, shame that the construct still does not allow the creation of an imaginary curve where you can position the object, however it can be programmed manually and it works very well.

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