How to prevent objects from moving off screen?

This forum is currently in read-only mode.
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hi guys, I've been through some of the tutorials, forums posts and documentation but I can't seem to find the parameter/code to prevent objects from moving off screen. By objects, I mean those that I've assigned movement behaviors to. Would appreciate it if someone could point me in the right direction.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's a phenomenon known as "Stainsor's Wall." Named after the Scirra Forum user "stainsor" (profile link here), no one is certain exactly what the origin of this strange contraption is. All we know for sure is that it works... the physics behind such a thing is beyond any human understanding.

    Here is an example of Stainsor's Wall in action:

    http://dl.getdropbox.com/u/529356/stain ... 20wall.cap

    If one were to try and define Stainsor's Wall (and believe me, many have), you might say it's "any Solid object placed beyond the boundaries of the Layout so as to contain the movable objects within." Suffice it to say it is truly one of nature's greatest mysteries.

    The earliest known manifestation of Stainsor's Wall was documented by the historian Herodotus in the 5th century BC. While taking account of the annual flooding of the Nile river, he wrote:

    "Circumstances rule men; men do not rule circumstances. The rising water held at bay not by the workings of mankind, but Providence, for it hath afforded a force beyond reckoning, in the form of a wall; beneficent, yet fraught with dire consequence, for yea though it hold back the raging flood man cannot hope to recompense nor even glean it's true nature. And it is in this that man sees his helplessness, and despairs."

  • Hi deadeye, thanks for your swift reply. Would the method above be appropriate if I were to use it in the ghost shooter tutorial to prevent the monsters and the player from moving off screen?

  • You can prevent the player from leaving the screen, yes. But the ghosts are bullet objects and have no built-in function to keep them in when hitting a solid object. You could always make a "bounce" event that turns them away from the wall and back into the layout, though.

  • Ah, that's what I was looking for thanks.

    ps: interesting commentary on the Stainsor's wall effect. Parmenides would beg to differ. For it was said,

    "Helplessness guides the wandering thought in their breasts; they are carried along deaf and blind alike, dazed, beasts without judgment, convinced that to be and not to be are the same and not the same, and that the road of all things is a backward-turning one"

  • That sounds like a rather despairing quote to me, actually. Perhaps one in which the helpless do not bemoan their circumstance, but only because they are so far removed from hope that they no longer wail; merely abiding in listless stagnation, the lost wandering in the ashen landscape of a pitifully average existence and wondering only vaguely at the quiet unease that permeates their lives.

    This, too, is Stainsor's Wall.

  • I laughed at this whole thread. Awesome.

  • I laughed at this whole thread. Awesome.

    This.

    HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA

    fucking epic

    ~Sol

  • the lost wandering in the ashen landscape

    I laughed when i read this part.

    Btw, wall boundaries are not the best method (In some cases they are) because they allow for skip-through with faster moving objects. A raw coordinate boundary is usually the ULTIMATE SAFEST.

    Obj.x < 0 ==> set obj x to 0

    Obj.x > right boundary ==> set obj x to right boundary x

    repeat for y coords.

  • Btw, wall boundaries are not the best method (In some cases they are) because they allow for skip-through with faster moving objects.

    I found myself using a wall too since I needed the behavior's reaction to it (bouncing, keeping momentum, etc.). However, proper speed capping and lower-fps bounding fixes the skip-through issue.

    Now about this Parmenides fellow, I believe that originally went like this:

    breasts guides the wandering thought Helplessly; they are carried along deaf and blind alike, dazed, beasts without judgment, convinced that to be and not to be are the same and not the same, and that the road of all things is a backward-turning one"

    Backwards. Yes.

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