Added some more undead and fixed the random function.
This commit is contained in:
parent
6007976d23
commit
3a464d8ea6
|
@ -47,6 +47,7 @@ add_executable(breakhack
|
||||||
src/stats
|
src/stats
|
||||||
src/actiontext
|
src/actiontext
|
||||||
src/random
|
src/random
|
||||||
|
src/pathfind
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(breakhack
|
target_link_libraries(breakhack
|
||||||
|
|
|
@ -37,6 +37,8 @@ local texturePaths = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local enemies = {
|
local enemies = {
|
||||||
|
|
||||||
|
-- PESTS
|
||||||
{ texturePaths.pest0, texturePaths.pest1, 0, 0 },
|
{ texturePaths.pest0, texturePaths.pest1, 0, 0 },
|
||||||
{ texturePaths.pest0, texturePaths.pest1, 16, 0 },
|
{ texturePaths.pest0, texturePaths.pest1, 16, 0 },
|
||||||
{ texturePaths.pest0, texturePaths.pest1, 32, 0 },
|
{ texturePaths.pest0, texturePaths.pest1, 32, 0 },
|
||||||
|
@ -84,6 +86,25 @@ local enemies = {
|
||||||
{ texturePaths.pest0, texturePaths.pest1, 32, 112 },
|
{ texturePaths.pest0, texturePaths.pest1, 32, 112 },
|
||||||
{ texturePaths.pest0, texturePaths.pest1, 48, 112 },
|
{ texturePaths.pest0, texturePaths.pest1, 48, 112 },
|
||||||
|
|
||||||
|
-- UNDEAD
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 0, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 16, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 32, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 48, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 64, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 80, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 96, 0 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 112, 0 };
|
||||||
|
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 0, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 16, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 32, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 48, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 64, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 80, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 96, 16 };
|
||||||
|
{ texturePaths.undead0, texturePaths.undead1, 112, 16 };
|
||||||
|
|
||||||
{ texturePaths.undead0, texturePaths.undead1, 0, 32 };
|
{ texturePaths.undead0, texturePaths.undead1, 0, 32 };
|
||||||
{ texturePaths.undead0, texturePaths.undead1, 16, 32 };
|
{ texturePaths.undead0, texturePaths.undead1, 16, 32 };
|
||||||
{ texturePaths.undead0, texturePaths.undead1, 32, 32 };
|
{ texturePaths.undead0, texturePaths.undead1, 32, 32 };
|
||||||
|
|
|
@ -108,7 +108,7 @@ monster_move(Monster *m, RoomMatrix *rm)
|
||||||
unsigned int i, maxMoveAttempts = 6;
|
unsigned int i, maxMoveAttempts = 6;
|
||||||
Position monsterRoomPos;
|
Position monsterRoomPos;
|
||||||
|
|
||||||
if (get_random(4) == 0)
|
if (get_random(2) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
monsterRoomPos = position_to_matrix_coords(&m->sprite->pos);
|
monsterRoomPos = position_to_matrix_coords(&m->sprite->pos);
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
unsigned int
|
unsigned int
|
||||||
get_random(unsigned int max)
|
get_random(unsigned int max)
|
||||||
{
|
{
|
||||||
|
static bool seeded = false;
|
||||||
|
if (!seeded) {
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
seeded = true;
|
||||||
|
}
|
||||||
|
|
||||||
return rand() % (max + 1);
|
return rand() % (max + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue