Add dying animation

This commit is contained in:
Miloslav Číž 2019-12-29 15:06:56 +01:00
parent fae1c5c4c0
commit a99882eb97
3 changed files with 66 additions and 46 deletions

View File

@ -951,6 +951,25 @@ SFG_PROGRAM_MEMORY uint8_t SFG_monsterSprites[][SFG_TEXTURE_STORE_SIZE] =
124,16,0,0,0,0,0,0,0,0,1,32,1,131,16,1,70,57,0,0,0,0,0,0,0,0,1,18,33,129,0,0,19, 124,16,0,0,0,0,0,0,0,0,1,32,1,131,16,1,70,57,0,0,0,0,0,0,0,0,1,18,33,129,0,0,19,
187,144,0,0,0,0,0,0,0,0,17,17,129,0,0,5,155,153,0,0,0,0,0,0,0,0,0,1,16,0,0,0,5, 187,144,0,0,0,0,0,0,0,0,17,17,129,0,0,5,155,153,0,0,0,0,0,0,0,0,0,1,16,0,0,0,5,
80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
},
{ // 17 universal dying sprite
175,0,223,1,3,4,5,2,6,73,135,79,26,159,131,37,0,0,0,0,0,0,0,0,0,0,0,51,0,0,0,0,
0,0,0,0,0,2,0,0,0,34,32,51,0,0,0,0,0,0,0,0,0,2,32,0,2,163,34,0,0,0,0,0,0,0,0,0,
0,0,0,0,42,3,50,33,16,0,0,0,0,0,0,0,0,0,1,16,32,0,2,22,97,16,0,0,0,0,0,0,0,1,24,
129,16,0,1,119,85,81,0,0,0,0,0,0,0,24,134,134,1,16,1,68,119,84,16,0,0,0,0,0,0,
24,102,136,102,81,0,20,68,116,16,0,0,0,0,0,1,102,102,104,134,65,2,20,68,151,113,
0,0,0,0,0,1,101,86,102,101,48,2,1,68,73,113,0,0,0,0,0,1,101,85,102,100,48,35,52,
17,73,16,0,0,0,0,0,1,85,85,85,71,51,37,84,48,17,0,0,0,0,0,0,1,84,80,80,71,50,34,
36,48,0,0,0,0,0,0,0,0,20,68,68,115,34,85,34,35,0,51,0,0,0,0,0,0,1,68,19,50,42,
51,85,34,3,48,0,0,0,0,0,0,0,17,34,34,163,101,51,67,32,0,0,0,0,0,0,0,0,2,42,68,
83,67,85,49,0,0,0,0,0,0,0,0,2,34,0,53,51,53,51,84,16,0,0,0,0,0,0,0,0,32,0,1,187,
211,115,21,16,0,0,0,0,0,0,0,2,32,0,27,189,211,48,23,16,0,0,0,0,0,0,0,2,0,0,27,
221,209,1,97,0,0,0,0,0,0,0,0,0,0,1,155,221,65,1,112,1,17,16,0,0,0,0,0,0,0,22,
153,145,17,22,49,22,117,16,0,0,0,0,0,0,1,101,84,113,0,23,54,102,53,16,0,0,0,0,0,
0,33,85,84,121,16,1,85,68,55,81,0,0,0,0,0,2,33,68,73,17,193,1,68,71,115,65,0,0,
0,0,0,34,42,153,145,1,195,16,23,119,115,65,0,0,0,0,0,32,2,170,34,31,236,49,23,
116,17,17,0,0,0,0,0,0,0,34,2,24,238,193,1,17,0,0,0,0,0,0,0,0,0,32,0,24,254,193,
0,35,48,0,0,0,0,0,0,0,0,0,0,1,17,16,2,32,48,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,0
} }
}; };

BIN
assets/monster_dying.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

93
main.c
View File

@ -510,59 +510,60 @@ static inline uint8_t SFG_RCLUnitToZBuffer(RCL_Unit x)
const uint8_t *SFG_getMonsterSprite( const uint8_t *SFG_getMonsterSprite(
uint8_t monsterType, uint8_t state, uint8_t frame) uint8_t monsterType, uint8_t state, uint8_t frame)
{ {
uint8_t index = 0; // makes the code smaller compared to returning pointers uint8_t index = 17; // makes the code smaller compared to returning pointers
switch (monsterType) if (state != SFG_MONSTER_STATE_DYING)
{ switch (monsterType)
case SFG_LEVEL_ELEMENT_MONSTER_SPIDER: {
switch (state) case SFG_LEVEL_ELEMENT_MONSTER_SPIDER:
{ switch (state)
case SFG_MONSTER_STATE_ATTACKING: index = 1; break; {
case SFG_MONSTER_STATE_IDLE: index = 0; break; case SFG_MONSTER_STATE_ATTACKING: index = 1; break;
default: index = frame ? 0 : 2; break; case SFG_MONSTER_STATE_IDLE: index = 0; break;
} default: index = frame ? 0 : 2; break;
break; }
break;
case SFG_LEVEL_ELEMENT_MONSTER_WARRIOR: case SFG_LEVEL_ELEMENT_MONSTER_WARRIOR:
index = state != SFG_MONSTER_STATE_ATTACKING ? 6 : 7; index = state != SFG_MONSTER_STATE_ATTACKING ? 6 : 7;
break; break;
case SFG_LEVEL_ELEMENT_MONSTER_DESTROYER: case SFG_LEVEL_ELEMENT_MONSTER_DESTROYER:
switch (state) switch (state)
{ {
case SFG_MONSTER_STATE_ATTACKING: index = 4; break; case SFG_MONSTER_STATE_ATTACKING: index = 4; break;
case SFG_MONSTER_STATE_IDLE: index = 3; break; case SFG_MONSTER_STATE_IDLE: index = 3; break;
default: index = frame ? 3 : 5; break; default: index = frame ? 3 : 5; break;
} }
break; break;
case SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT: case SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT:
index = state != SFG_MONSTER_STATE_ATTACKING ? 8 : 9; index = state != SFG_MONSTER_STATE_ATTACKING ? 8 : 9;
break; break;
case SFG_LEVEL_ELEMENT_MONSTER_ENDER: case SFG_LEVEL_ELEMENT_MONSTER_ENDER:
switch (state) switch (state)
{ {
case SFG_MONSTER_STATE_ATTACKING: index = 12; break; case SFG_MONSTER_STATE_ATTACKING: index = 12; break;
case SFG_MONSTER_STATE_IDLE: index = 10; break; case SFG_MONSTER_STATE_IDLE: index = 10; break;
default: index = frame ? 10 : 11; break; default: index = frame ? 10 : 11; break;
} }
break; break;
case SFG_LEVEL_ELEMENT_MONSTER_TURRET: case SFG_LEVEL_ELEMENT_MONSTER_TURRET:
switch (state) switch (state)
{ {
case SFG_MONSTER_STATE_ATTACKING: index = 15; break; case SFG_MONSTER_STATE_ATTACKING: index = 15; break;
case SFG_MONSTER_STATE_IDLE: index = 13; break; case SFG_MONSTER_STATE_IDLE: index = 13; break;
default: index = frame ? 13 : 14; break; default: index = frame ? 13 : 14; break;
} }
break; break;
case SFG_LEVEL_ELEMENT_MONSTER_EXPLODER: case SFG_LEVEL_ELEMENT_MONSTER_EXPLODER:
default: default:
index = 16; index = 16;
break; break;
} }
return SFG_monsterSprites[index]; return SFG_monsterSprites[index];
} }