Hi everyone! I am a new user of GOSU and I have almost found anything I needed either in the reference or in the tutorials but now, I am trying to solve a specific issue and I don't really know how to do it properly.
I am working on a 2D platformer in which I would like to use horizontal scrolling. I don't really know how to move the "2D camera" in GOSU. I have looked at some functions of the Bitmap class but I don't really know if that is the proper way... So if you could tell me any tutorial, doc or sth to perform scrolling, it would be nice!
Thanks in advance!
Make a variable to hold horizontal position. Each image should be drawn subtracting this value from x position.
I don't know C++ so much, but in Ruby it looks like this: image.draw(image_x - screen_x , image_y)
When screen_x increases, images are going to the left. For drawing you can also use translate method.
Yep, translation is the way to go. You can call
graphics().pushTransform(Gosu::translate(-cameraX, -cameraY)), then draw everything, then
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill