start of movement and map

This commit is contained in:
Samuel Walker 2024-08-29 18:49:38 -06:00
parent 3b95d24e5e
commit 5a35105640

View File

@ -1,7 +1,21 @@
#include <genesis.h>
#define SPEED 2
Line l;
const u8[][] = [[1,1,1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,0,0,1],
[1,1,1,1,0,0,1,1,1,1],
[1,0,0,1,0,0,1,0,0,1],
[1,0,0,0,0,0,1,0,0,1],
[1,0,0,1,0,0,1,1,0,1],
[1,1,1,1,0,0,1,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,1,0,0,1],
[1,1,1,1,1,1,1,1,1,1]];
void render(){
//Clear the bitmap
BMP_clear();
@ -21,18 +35,38 @@ void render(){
l.pt2.y = 0;
}
SYS_doVBlankProcess();
}
void update(){
u16 joy = JOY_readJoypad(JOY_1);
if(joy & BUTTON_LEFT) {
l.pt1.x -= SPEED;
}
if(joy & BUTTON_RIGHT) {
l.pt1.x += SPEED;
}
if(joy & BUTTON_UP) {
l.pt1.y -= SPEED;
}
if(joy & BUTTON_DOWN) {
l.pt1.y += SPEED;
}
}
void initVDP(){
SYS_disableInts();
VDP_setPlaneSize(64,32,TRUE);
SYS_enableInts();
}
int main()
{
initVDP();
//Initialise the bitmap engine
BMP_init(TRUE, BG_A, PAL0, FALSE);
BMP_init(FALSE, BG_A, PAL0, FALSE);
//Set the colour of the line. We are using pallete 0 for the bitmap, so we have 0->15. 15 is used for white text, so we set an unused pallet colour, 14 to blue - RGB 0000FF.
u16 colour_blue = RGB24_TO_VDPCOLOR(0x0000ff);
@ -52,6 +86,7 @@ int main()
while(TRUE)
{
render();
update();
}
return 0;
}