Make the screen scroll upwards

Get help using Construct 2

Post » Mon Mar 11, 2013 8:36 am

Here, 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.

Posts: 6
Reputation: 489

Post » Mon Mar 11, 2013 10:50 am

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.
Posts: 27
Reputation: 1,856

Post » Mon Mar 11, 2013 11:13 am

@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: "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)

ChrisTheStoepsel20012013-03-11 11:14:56
Posts: 33
Reputation: 816

Post » Thu Mar 21, 2013 8:33 am

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.
Posts: 6
Reputation: 489

Return to How do I....?

Who is online

Users browsing this forum: bangoo, chal, DerpyDev, Khelben, Mato, Mysternof, SacrilAI and 1 guest