vertical ship scrolling and player staying on screen

0 favourites
  • 5 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • I got the screen and player to automatically scroll up till the end of the level but I can't keep the player from moving past the edge of the screen. If I make the player bound to layout, the player won't be able to move past the end of the view port. You can't make the viewport taller, that just messes everything up. I tried to code some coordinates for the boundaries for a condition to movement and none of those work. I saw someone else do this and it worked but I can't figure out what he did different. What would be the best way to handle levels for a old school vertical scrolling shooter where the player and camera scrolls until the end?

  • You can keep the player stay in the screen.

    Make everything scroll down to your place.

  • I meant like to the left or right or top or bottom, if I move to the edge, I want the ship to stop right at the edge, rather than keep going off the screen.

  • You can add the behavior Bound to layout to your ship.

    And the Layout size will equal the Viewport Size, because your ship just stay in the layout, everything will come to him.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if I move to the edge, I want the ship to stop right at the edge, rather than keep going off the screen.

    Well, I think you can do something like:

    ---

    If => the player touches the edge of the layout :

    Disable the ScrollTo behaviour.

    Start a timer of 3 seconds (choose your timelapse) once.

    -------------------

    If => After the 3 seconds timer the player is still touching the edge of the layout:

    Restart the 3 seconds timer once.

    ---

    Else => Enable back the ScrollTo behaviours (to continue the automatic scrolling).

    ---------------------

    My explanations above are NOT real code, I just to show you the visual of how to make your requested feature work.

    By playing with the enable/disable ScrollTo behaviour, you can play/pause the automatic scrolling.

    If you are asking why a timer of 3 seconds, it's because keeping checking the collision between the player and the edge of the layout can possibly be a problem if you had some physics stuff after. However, by adding a 3 seconds timer, you get a little cooldown to smoothly resume the ScrollTo behaviour.

    This is how I would do it. Depend on your needs.

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