Main Menu

Wrap Scrolling

Started by kevin, January 30, 2007, 04:23:43 PM

Previous topic - Next topic

kevin

   This example shows how the scene and camera controls in PlayBasic can be used to create (the illusion of) an infinite scrolling worlds, that wrap on the X axis. It works by processing all gfx into the common scene buffer first. Then we work out what sections of the world we can see, set the camera & screen view port area and draw that segment. If the segment was thinner than the screen with, we draw the neighboring another segment and so on.   While the demo is only set up to handle wrapping on the X axis, the same method will work on the Y axis, plus any combination's thereof.     But that's an experiment for the reader :)

   The demo also includes some basic flying objects. Objects are special case, by that i mean, if an object is intersecting a boundary edge of the world space, we need to draw a refection of this objects gfx to the other side of the world. This will ensure the illusion is seamless.




Download Source Code From PlayBASIC.com


Ian Price

On the contrary Kevin, I'm learning new stuff all the time. I managed to optimise Sorcery by nearly 4x the number of frames per second recently, giving me loads of room for additional stuff. :) I used techniques that I'd not used before, which assisted with other routines at the same time. Double bonus!

TBH I came up with my own routines because the languages I was using didn't do what I wanted when I needed them. PB appears to buck this trend and have more to it than I can possibly need at this time. I just don't have the time to sit down and play with everything; I've always got something else to work on.
I came. I saw. I played some Nintendo.