Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

code2win
If you want you can check-out/Review my program which demonstrates how to code smooth scrolling of sprite bitmaps with manual bit-shifting. Also the clearing around a sprite instead of calling Screen.clearScreen(), which causes excessive flickering. Check the source and observe the lack of flickering, and sprite moving 1 pixel at a time.
https://www.coursera.org/learn/nand2tetris2/peer/kyLgr/project-9/review/cdTOtDqoEeqWKwoxdwIR-w
Reply | Threaded
Open this post in threaded view
|

Re: Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

ivant
Sounds very interesting. If this does not cause any problems for you, would you put it on github or similar repo, where one doesn't need to register to see it?
Reply | Threaded
Open this post in threaded view
|

Re: Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

code2win
This is pretty specific to the Jack language, to get around its limitations. Do you mean post it on github for users of the Jack language who are not taking the course?
I would probably want to clean it up and add support for signed ints/neg numbers (currently signed numbers have to be converted to unsigned in the bitmap entries for the bitshift to work). Someone else can do that and post it to github; fine with me.
Reply | Threaded
Open this post in threaded view
|

Re: Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

ivant
code2win wrote
This is pretty specific to the Jack language, to get around its limitations. Do you mean post it on github for users of the Jack language who are not taking the course?
Yes, that's what I meant.
Reply | Threaded
Open this post in threaded view
|

Re: Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

code2win
To build upon the smart-clearing, When we clear around any sprite we can check an entity table, containing positions of entities, and determine with decision control if the square next to the sprite should be cleared based on that table. I think that's how I would build upon this idea when i move beyond 1 sprite.
Reply | Threaded
Open this post in threaded view
|

Re: Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

code2win
This post was updated on .
I might revisit this code and expand on it when I complete the remaining chapters.
Ya know, this smart-clearing reminds me of what John Carmack did with selective tile refresh, back when computer's lack of performance couldn't handle side-scrolling games.
Reply | Threaded
Open this post in threaded view
|

Re: Smooth Scrolling Sprite Bitmap with Bit-Shift and Smart-Clearing.

code2win
Looks like I didn't only made the bitmap 15 wide instead of 16 wide. the memory bus only allows for 15 + 1 control bit. I think I get an inkling of how the signed numbers works to get that 16th row of the bitmap. Next couple chapters might shed some light on this. Something else to fix in the code...