foreground work
This commit is contained in:
parent
dbd635fa26
commit
4211296f3b
|
@ -30,7 +30,7 @@ fix16 bgPosXF[GAME_H_T];
|
|||
|
||||
static void scrollBg(){
|
||||
for(u8 y = 0; y < GAME_H_T; y++){
|
||||
if(y > 3) bgPosXF[y] = fix16Sub(bgPosXF[y], BG_SPEED);
|
||||
if(y > 2) bgPosXF[y] = fix16Sub(bgPosXF[y], BG_SPEED);
|
||||
if(bgPosXF[y] <= -BG_SIZE_F) bgPosXF[y] = fix16Add(bgPosXF[y], BG_SIZE_F);
|
||||
bgPosX[y] = fix16ToInt(bgPosXF[y]);
|
||||
}
|
||||
|
|
|
@ -26,18 +26,24 @@ SpriteDefinition* currentBottomImage;
|
|||
static void drawFg(){
|
||||
switch(currentFg){
|
||||
case 0:
|
||||
currentTopImage = &rock1Top;
|
||||
currentBottomImage = &rock1Bottom;
|
||||
VDP_loadTileSet(rock1Top.tileset, FG_I, DMA);
|
||||
VDP_loadTileSet(rock1Bottom.tileset, FG_I + 16, DMA);
|
||||
break;
|
||||
case 1:
|
||||
currentTopImage = &rock2Top;
|
||||
currentBottomImage = &rock2Bottom;
|
||||
VDP_loadTileSet(rock2Top.tileset, FG_I, DMA);
|
||||
VDP_loadTileSet(rock2Bottom.tileset, FG_I + 16, DMA);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for(u16 x = 0; x < FG_W; x++){
|
||||
if(x % 4 == 0){
|
||||
VDP_drawImageEx(BG_B, currentTopImage, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I), x, CEIL_Y, 0, DMA);
|
||||
VDP_drawImageEx(BG_B, currentBottomImage, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + 16), x, FLOOR_Y, 0, DMA);
|
||||
for(s16 i = 0; i < 4; i++){
|
||||
for(s16 j = 0; j < 4; j++){
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + i + 4 * j), x + i, CEIL_Y + j);
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + 16 + i + 4 * j), x + i, FLOOR_Y + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,17 +97,15 @@ static void spawnObstacle(bool top, s16 offset, u8 type){
|
|||
#define OBSTACLE_MOD FIX16(8)
|
||||
#define OBSTACLE_LIMIT_X FIX16(-64)
|
||||
|
||||
SpriteDefinition* obstacleImage;
|
||||
|
||||
static void killObstacle(s16 i){
|
||||
obstacles[i].active = FALSE;
|
||||
VDP_clearTileMapRect(BG_B, obstacles[i].startX, obstacles[i].top ? OBS_CEIL_Y + 4 : OBS_FLOOR_Y, 4, 4);
|
||||
VDP_drawImageEx(BG_B,
|
||||
obstacles[i].top ? currentTopImage : currentBottomImage,
|
||||
TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + (obstacles[i].top ? 0 : 16)),
|
||||
obstacles[i].startX,
|
||||
obstacles[i].top ? CEIL_Y : FLOOR_Y,
|
||||
0, DMA_QUEUE);
|
||||
for(s16 h = 0; h < 4; h++){
|
||||
for(s16 j = 0; j < 4; j++){
|
||||
if(obstacles[i].top) VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + h + 4 * j), obstacles[i].startX + h, CEIL_Y + j);
|
||||
else VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + 16 + h + 4 * j), obstacles[i].startX + h, FLOOR_Y + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void collideObstacle(s16 i){
|
||||
|
|
Reference in New Issue