diff --git a/15.c b/15.c index 6319b15..c40714f 100644 --- a/15.c +++ b/15.c @@ -63,8 +63,7 @@ void init() { for(int i = 0; i < 15; ++i) { char filename[256] = {}; sprintf(filename, "data/sprite/15/%d.png", i+1); - Sprite sprite = createSpriteEx(0, 0, 1, 1); - spriteSetAnimation(sprite, createAnimation(filename)); + Sprite sprite = createSpriteEx(0, 0, 1, 1, createAnimation(filename)); spriteSetColliderRectangle(sprite, 0, 0, 0, 1, 1, 0.1); groupAdd(group, sprite); } diff --git a/2048.c b/2048.c index 1211e47..cb4b2bf 100644 --- a/2048.c +++ b/2048.c @@ -27,8 +27,7 @@ void setSprite(Cell *cell, double x, double y) { groupDestroyEach(cell->group); else cell->group = createGroup(); - Sprite sprite = createSpriteEx(x, y, 1, 1); - spriteSetAnimation(sprite, numbers[cell->value]); + Sprite sprite = createSpriteEx(x, y, 1, 1, numbers[cell->value]); groupAdd(cell->group, sprite); } diff --git a/snake.c b/snake.c index b1d48f0..6d2958e 100644 --- a/snake.c +++ b/snake.c @@ -26,7 +26,7 @@ enum GameMode { int grid[WIDTH][HEIGHT]; Sprite sprites[WIDTH][HEIGHT]; -Group gridGroup, storage; +Group gridGroup; Sound nom, cut; @@ -269,19 +269,10 @@ void init() { font = createFont("data/fonts/blackcry.ttf"); textFont(font); - storage = createGroup(); - Animation tiles[6] = { tileWall, tileFood, tileHead, tileBody, tileBend, tileTail }; - for(int i = 0; i < 6; ++i) { - Sprite s = createSprite(0, 0); - spriteSetAnimation(s, tiles[i]); - groupAdd(storage, s); - } - groupSetVisibleEach(storage, FALSE); - gridGroup = createGroup(); for(int x = 0; x < WIDTH; ++x) { for(int y = 0; y < HEIGHT; ++y) { - Sprite s = createSpriteEx((x + 0.5)*SIZE, (y + 0.5)*SIZE, SIZE, SIZE); + Sprite s = createSprite((x + 0.5)*SIZE, (y + 0.5)*SIZE, SIZE, SIZE); spriteSetShapeColor(s, colorByName("transparent")); groupAdd(gridGroup, s); sprites[x][y] = s; diff --git a/sokoban.c b/sokoban.c index 718c6a1..147c61f 100644 --- a/sokoban.c +++ b/sokoban.c @@ -51,23 +51,20 @@ void loadLevel() { if (c == '\n') { y += 64; x = 32; continue; } if (c == '.') { - s = createSpriteEx(x, y, 10, 10); - spriteSetAnimation(s, animPlace); + s = createSpriteEx(x, y, 10, 10, animPlace); spriteSetColliderCircle(s, 0, 0, -1); spriteSetDepth(s, 1); groupAdd(places, s); } else if (c == '#') { - s = createSpriteEx(x, y, 64, 64); - spriteSetAnimation(s, animWall); + s = createSpriteEx(x, y, 64, 64, animWall); spriteSetMassLevel(s, 100); groupAdd(walls, s); if (maxX < x) maxX = x; if (maxY < y) maxY = y; } else if (c == 'B') { - s = createSpriteEx(x, y, 62, 62); - spriteSetAnimation(s, animBox); + s = createSpriteEx(x, y, 62, 62, animBox); spriteSetColliderRectangle(s, 0, 0, 0, -1, -1, 16); groupAdd(boxes, s); } else @@ -95,8 +92,7 @@ void init() { font = createFont("data/fonts/blackcry.ttf"); textFont(font); - player = createSpriteEx(0, 0, 62, 62); - spriteSetAnimation(player, animPlayer); + player = createSpriteEx(0, 0, 62, 62, animPlayer); spriteSetColliderCircle(player, 0, 0, -1); walls = createGroup();