Looking for vertical scrolling


(Kevinabraun) #1

Hello Ardubrains,

I am working on a game, and need to scroll vertically. It is not a tile map, just lines on the screen using the draw functions, are there examples of vertical scrolling?

Thank you.

KB


(Kevinabraun) #2

I should have explained better, the screen is 2:1 so that does indeed favor horizontal scrollers, and there are a few of them. My goal is a vertical game, and I am looking for clues that it’s practical. In the ancient days (when I’m from) 8-bit computer manuals explained all of the commands supported by that platform. The Sam Coupe for example, had scrolling commands in it’s BASIC that let you scroll by setting a flag. I realize it is not so easy on the Arduboy, but I could use a hint.

Thank you again.


(Scott R) #3

Do you mean like this?

You can find documentation for the library here
https://mlxxxp.github.io/documents/Arduino/libraries/Arduboy2/Doxygen/html/index.html

See Classes->Arduboy2Core

There’s a few vertically scrolling games already one example is


(Pharap) #4

From what I gather vertical hardware scrolling is hard to control.

I completely forgot about Love Rush being vertically scrolled, that’s a pretty good example.


(Simon) #5

Hardware scrolling is possible but the issue is that the onscreen contents are scrolled but not the screen buffer in memory. This really only makes sense if you are writing directly to the screen without a buffer which presents many other problems. For example, the screen has scrolled 1 pixel down. Your player needs to be redrawn in the correct location but as it may have moved, you will need to redraw any scenery that is now revealed.

I slapped together a sideways scrolling routine here that scrolls the screen buffer. You could create a similar thing that scrolls vertically but the layout of the Arduboy’s screen memory makes it really CPU intensive as you need to bit shift each byte to move it a pixel at a time.


(Pharap) #6

If there was some overscan and better timing control then it might have been partially viable,
but then you’d still have to redraw your entities each time.

If I ever meet the person who decided that AVR chips shouldn’t have a barrel shifter…


(Simon) #7

Yes, I wonder if it was an oversight or there was a real reason?


(Scott R) #8

Not 100% but you could also make the game using horizontal scrolling and rotate the screen like Adafruits SetRotation() I was going to do this with love rush to make it a Tate scroller for the purple card but never got round to it.


(Pharap) #9

It would be a pretty big oversight.
Most likely it was for cost-cutting reasons, or to make the chips easier to manufacture.


#10

On Arduboy it is custom redraw each display frame completely rather than to update part of the display buffer. You could just add a scroll offset to each y coordinate of your lines.