OhhHhhhh, shiny colours and still backwards compatible with the gameboy original, yay!
So, tonight, I fixed up my scrolling code, it turns out I wasn’t too far out with what I had done before a few nights ago, but little bits of code logic were incorrect and, after I noticed that my main issue was that my test level length wasn’t divisible by 32, which was causing the second scrolling loop to become maligned by 4 rows each time through, the rest came together pretty easily.
Now that’s working though, I’ve bugged out my rather basic background collision routine, which now needs to sync up with the scrolling background rather than simply integer divide the y position.
Basically, it needs an offset or two to get working again, which should be okay, as long as it accounts well for overflows should they occur, that’s for tomorrow though now.
There’s a little animated gif attached to this tweet if you fancy a looksy –> https://twitter.com/refreshgamesuk/status/698307905217548288
Yay! Turns out it wasn’t too tough to get the collision working there, man, does visual feedback help out a shit ton with coding, I’m loving all the features in BGB, A really great Gameboy Emulator, they really help me out here.
So yeah, hopefully, that GIF will animate and you’ll see the friction applied to the car when it goes off-track. Simple stuff but hey, it’s working well and fairly quickly (I’ve got around 90% of CPU left per frame when the debugging is removed and roughly 70% with debug info being output every frame (not optimal, I know)
I’m going to need some animation frame for the car at some point, so it can at least have some appearance of turning, maybe 2 frames of animation. I can get away with only 8 tiles for that with sprite flipping, which is going to prove to be a great bonus when I get around to sparks and explosions further along the month!
Soo, yeah, next up animation frames and making other collision objects stop the car / explode it into tiny pieces, ohh rahh!
Before I sign off on this update, I should note some other systems I’ll put in ,obvoius control schemes for controlling using A and B for gas and brakes, with the D-Pad for steering, pressing up could use some sorta Turbo maybe. That would be pretty cool to figure out.
There’s still Scrolling, Music, SFX and maybe some rudimentary homing A.I. to add here, but I think the code loops should be tight enough to keep the gameboys 60fps with some cunning compression, I could make some super long levels also.