How do I Stop the player from leaving the screen

0 favourites
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi

    My player sprite is made up of three parts (because the collision area is only meant to work with one part of the player is why this is) and so when it is dragged, I have had to unpin and re pin the objects each time.

    I am trying to stop the player object(s) from leaving the "player area" and have tried to add the behaviour bound to layout but this still seems to A) allow the player object(s) leave the bottom section of the game area and b) when the top part of the player object reaches the top part of the game area, the player object starts to be pushed around so that the "head" part of the object drops and the "handle" part of the object because parallel to it. This is really hard to explain but in essence instead of the objects all keeping together and just stopping when they hit the stop, they start to be pushed apart.

    Any thoughts how to overcome this please?

    Thanks

    TimCS

  • There is probably some smart way of doing this but in my game when like a boss battle started that was only on 1 screen, I simply placed walls around the window and made them invisible and 1 px wide

  • Hi Triforce

    Thanks for this suggestions, I stupidly forgot to mention that I have random enemies that spawn off screen and then move towards targets that are on screen. If I created these "walls" which I suspect would then have collision as well, would these stop the enemies from entering the gaming screen ?

    Thanks

    TimCS

  • I have tried the following to get this to work, created a sprite called borders and simply fill this as a colour , then added a solid behaviour to it and for testing set one part of the player as a platform player. Took out the gravity as I do not need this and it seemed to work but now and again, it would allow the player to pass through the "solid" object any reason why this would be ?

    Thanks

    TimCS

  • A screenshot would be nice.

  • A screenshot would be nice.

    Sorry to be secretive LoneVox I am trying to keep this project under wraps at the moment.

    If you are after a screen shot of the level 1 design , then it is simply something like the attachment provided could not see a way to attach it other than a link to an URL this may not say on line for too long however

    Here are the settings for the player :

    And here is the settings for the borders :

    Thanks

    TimCS

  • Its not working the bound to layout behavior? Also, checking if the item is overlapping the wall before running its events should be enough.

    Sample CAPX: https://dl.dropboxusercontent.com/u/470 ... %20AI.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Its not working the bound to layout behavior? Also, checking if the item is overlapping the wall before running its events should be enough.

    This is what I tried first but as mentioned this causing other issues.

    With regards the overlapping check when you say "before running its events" what do you mean by this ? which object and what events

    Thanks

    TimCS

  • I did a sample for you: https://dl.dropboxusercontent.com/u/470 ... %20AI.capx

    Thanks TELLES0808 willl look at this and see if it solves my problem

    Thanks

    TimCS

  • It's just the basic, you need to improve it with more AI. =]

  • Hi again Telles0808

    I am running on the free version of Contruct 2 at this time and the latest version I can obtain is 239, however the project file you have kindly added to this thread is for version 240 so I cannot open it . I presume there is no way of saving this to an older version of Construct 2 ?

    Thanks

    TimCS

  • You still be able to open it.

    I'll ask you to do some steps:

    • Change the file extension from ".capx" to ".zip";
    • Extract it;
    • Open the ".caproj" file with notepad;
    • Find the line with <saved-with-version>24000</saved-with-version> and change the "24000" to "23900";
    • open the .caproj using C2;

    That's it. =]

  • Hi again TELLES0808

    Not sure if it is to do with my version of Construct 2 but when I run the example, the object do eventually leave the screen. Is this an issue with my version of Construct 2 ?

    Thanks

    TimCS

  • 6 Parts. The super simple way (you misunderstood 'layout' in BoundToLayout).

    https://www.dropbox.com/s/qp8ylpczixfrt ... .capx?dl=0

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