0 Favourites

Seperate platform "screens"

  • Hello, I'm new here, and this is my first post.

    By way of introduction, I am a 25 law student, so I don't have a lot of free time, but I have felt like doing a little game creation on the side and thought I'd give Construct a chance. Over a decade a go I saved up my allowance to buy a copy of MultiMedia Fusion when it first came out (I had been using click-n-play before that) and I have a tiny bit of programming experience (1 class in college). So a user friendly program like Construct is perfect for me!

    Anyway, I downloaded Construct tonight, followed the platforming tutorial and found it made a lot of sense. I figured out how to add power ups to increase jump strength, add air jumps, and so on, and was excited to continue working on hashing out some metroidvania concepts. But then I ran into a problem, and part of the problem was I wasn't quite sure how to describe what was looking for.

    I wanted to have the screen scroll to a new area when the player left the screen (Like in , VVVVVV, Jumpman, I wanna be the Guy, and so on), not scroll gradually with the player. I initially began by setting up specific areas, like so:

    <img src="http://i46.tinypic.com/28tga3t.png" border="0" />

    I felt like this was really inelegant though, because as I expand the game, I'd have to keep adding new regions to scroll too. So I tried to find a more simple and easier solution on the forums and couldn't. Because I didn't know what to search for I tried for a while to figure it out. And I did! Anyway, in case anyone wants to do this same thing, here is the solution I came up with:

    <img src="http://i45.tinypic.com/a1jtxz.png" border="0" />

    300 is size of the screen, so if your screen is bigger, substitute that value and change 150 to whatever half of it is. The floor() operation rounds down to the nearest chunk of 300 pixels so the character can move between screens and the camera will move to the appropriate region (or "screen") of the layout.

    I hope this helps someone, and if it's already been covered, please let me know! Also let me know if you know of a better way to describe this camera behavior, or if there is a cleaner or better way to do this.

    If this is helpful, I'd be honered if it were added to the How do I... FAQ.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)