Add new map "empty", Increase game speed
This commit is contained in:
parent
cf92191177
commit
3c0f837daa
@ -38,6 +38,7 @@ void gameInit()
|
||||
//load default map if no map loaded yet
|
||||
if (!game.mapIsLoaded){
|
||||
loadMapByName("default");
|
||||
//loadMapByName("empty");
|
||||
//loadMapByName("intermediate");
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
||||
while (game.gameState != EXIT)
|
||||
{
|
||||
processInputEvent();
|
||||
SDL_Delay(600);
|
||||
SDL_Delay(300);
|
||||
processInputEvent();
|
||||
runGameCycle();
|
||||
}
|
||||
|
22
src/map.c
22
src/map.c
@ -28,7 +28,7 @@ void renderGameToArray(int mapFrame[MAX_MAP_SIZE][MAX_MAP_SIZE], map_t map, snak
|
||||
{
|
||||
mapFrame[snake.tail[i][1]][snake.tail[i][0]] = 5;
|
||||
}
|
||||
// copy food
|
||||
// copy food
|
||||
mapFrame[game.foodY][game.foodX] = 6;
|
||||
// copy snake head (last element -> head overwrites previous elements)
|
||||
mapFrame[snake.headY][snake.headX] = 4;
|
||||
@ -185,6 +185,22 @@ static const map_t map_default = {
|
||||
.color = "blue"}},
|
||||
.portalCount = 1};
|
||||
|
||||
|
||||
static const map_t map_empty = {
|
||||
.width = 20,
|
||||
.height = 10,
|
||||
.name = "empty",
|
||||
.collisions = {},
|
||||
.collisionCount = 0,
|
||||
.portals = {
|
||||
{.posX = 5,
|
||||
.posY = 8,
|
||||
.targetX = 7,
|
||||
.targetY = 1,
|
||||
.color = "blue"}},
|
||||
.portalCount = 1};
|
||||
|
||||
|
||||
static const map_t map_intermediate = {
|
||||
.width = 15,
|
||||
.height = 15,
|
||||
@ -205,5 +221,5 @@ static const map_t map_intermediate = {
|
||||
.portalCount = 2};
|
||||
|
||||
// global variables for accessing the stored maps
|
||||
const map_t *storedMaps[16] = {&map_default, &map_intermediate};
|
||||
const int storedMapsCount = 2;
|
||||
const map_t *storedMaps[16] = {&map_default, &map_empty, &map_intermediate};
|
||||
const int storedMapsCount = 3;
|
Loading…
x
Reference in New Issue
Block a user