Make the screen scroll upwards

0 favourites
  • 4 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Here goo.gl/RNBEI, I've learned how to make the user jump etc.

    What now I want to do is, make the screen scroll vertically, and also, not make the user the center of attention.

    Kind of like Doodle Jump, if you have ever played it.

    What I want to do is, the screen will be scrolling upwards, irrespective of the user's position. My game would be to kill the user if he gets to the bottom edge of the layout. So the fun would be to keep jumping up and up.

    How can I do that?

    There's no example of that. I checked the example folder. The parallax one only moves the screen according to the user, and places him at the initial position again if goes off the layout.

    I want to do exactly the opposite - the user goes off the layout in the bottom edge, he dies. And he can be anywhere in the layout, but the screen won't center down on him. Please see the image.

    <img src="http://s22.postimage.org/jptcx1ne9/For_forum_ascension.jpg" border="0" />

  • I see two easy ways you could do this.

    The first would be to make a new object (let's call it "cameraObject"), and place it in the center of the screen. Make it invisible, and make the camera/view focus on it. Then, implement the code: "every frame > cameraObject.y = cameraObject.y - 1". This way, the camera will go upwards, but it will never come back down or go side-to-side. If you use this method, make sure that the camera isn't bound to the edges of the game world - otherwise, it will stop when cameraObject.y reaches zero.

    The second way would be to not use a camera at all. Simply move the blocks downwards when the player reaches a new height. "Every frame > for each block > block.y = block.y + 1". This method might be a little less intuitive to implement, but it can be more efficient, and is the "standard" way of making endless jumping/running games.

    Ultimately, go with the method that feels right to you. It would be silly to say that one method is "better" than the other.

  • SketchyLogic: Your option 1 sounds pretty much rock solid to me ;o) That's exactly the solution I thought of too when I read the question above.

    Regarding option 2: I do not have proof, but in one of the performance tutorials I found a hint that "scrolling to" would be much less ressource-consuming than moving objects.

    (see here: scirra.com/tutorials/298/performance-tips-for-mobile-games "10 - Scroll to is faster than moving eveyting").

    Don't know if that matters to austinpayne26, but to me the sketch above looks like your developing for mobile. In that case you might want to take that issue into account ;o)

    Regards,

    Chris

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply :)

    Actually I didn't understand the first approach - can you elaborate it a little more?

    And the second one - comes as no surprise that it's a standard way. I myself thought of it the day after I posted this. Seems easier too.

    Anyways, thank you so much!

    And hey, also, can you tell me why Scirra doesn't alert me with an email when I get replies to my questions? I've checked my settings, and I should be getting mails. I would always check for any mail related to my question being answered, and I got pissed. Finally I decided to come to the forum myself and here I found your answer already.

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