Control Camera with Endless Scrolling Scene?
Hi all,
Hoping someone can help me out. I am trying to create a movement similar to that in "Amazing Brick", but cannot figure it out. Here goes.
I have a game that spawns obstacles off-screen on top and them moves them down. The actor falls with gravity, but when touch is pressed it moves up and either to the left or the right in a jumping motion for a bit, then falls again. My issue is that I would like to have the actor not be able to move up past the middle of the screen. Rather when it gets to the middle of the screen all the other obstacles move down and past the actor to be recycled.
I tried using the control camera feature, but can't get it to work with an endless scrolling scene. Is that possible. I figured out how to make an endless scrolling screen and spawn obstacles where/when needed, but I would like the obstacles to move at the speed of the actor, only when the actor is moving upward and at least at the middle of the screen Y position, not lower. I basically only want the obstacles to move when the actor is moving up, but also to not have the actor ever be able to touch the top of the screen.
Is it possible to have a fluid motion and use the control camera feature on an endless screen? Also open to other options not using the camera feature. Any help is greatly appreciated! Thanks.
Answers
I might not be understanding this 100%, but why doesn't control camera work? Try making the scene some length higher than the camera, and set the tracking area to 0, and try some rule like "If [self.position.y] >= [scene.camera.origin.y+game.displaysize.height/2], then Control Camera."
Not sure if you already tried that or if it will help at all, but that's my attempt to help :P Good luck!
Thanks wcsd9739, but the control camera does work. I am just wondering if I can make it so that the actor never hits the top of the scene. Even if the scene is twice the height, with control camera, the actor still hits the top of the scene after going up two scene lengths. I'd like it to be endless scrolling, with the camera control, and not have to make an insanely large scene.
I don't know what your levels consist of but could you leave the player in the center of the screen and instead of scrolling the scene, scroll objects at the player? This is how games like Doodle Jump are done, the scene size is not necessarily large, its just the objects continue to spawn and travel toward the player making it seem endless and large. Just a thought.
Something like this maybe:
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thanks jamie_c for the video. Mine has more complex movements from both side to side and up and down so I can't constrain the Y attribute. Do you know if there is a way to use the control camera feature with an endlessly scrolling game? Control camera works great, but only until I get to the end of the scene.
I think I sorted this out without the control camera, but using a similar logic as the Doodle Jump games. Anyway, thanks much to those for offering the help!!
Glad you got something sorted. I didn't notice the reply above, it's a good idea to tag someone @sfkernan, so they get notified of a post.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page