mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-24 01:42:19 -05:00
Explode exploder
This commit is contained in:
parent
6cbe6f27c6
commit
d641abe5db
@ -52,7 +52,7 @@
|
||||
Says the (Chebyshev) distance in game squares at which level elements
|
||||
(items, monsters etc.) become active.
|
||||
*/
|
||||
#define SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE 8
|
||||
#define SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE 10
|
||||
|
||||
/**
|
||||
Rate at which AI will be updated, which also affects how fast enemies will
|
||||
|
25
main.c
25
main.c
@ -1279,6 +1279,16 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster)
|
||||
uint8_t mX = SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]);
|
||||
uint8_t mY = SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]);
|
||||
|
||||
if (!( // exploder will explode when close
|
||||
(type == SFG_LEVEL_ELEMENT_MONSTER_EXPLODER) &&
|
||||
(((mX > SFG_player.squarePosition[0]) ?
|
||||
(mX - SFG_player.squarePosition[0]) :
|
||||
(SFG_player.squarePosition[0] - mX)) <= 1) &&
|
||||
(((mY > SFG_player.squarePosition[1]) ?
|
||||
(mY - SFG_player.squarePosition[1]) :
|
||||
(SFG_player.squarePosition[1] - mY)) <= 1)
|
||||
))
|
||||
{
|
||||
if (mX > SFG_player.squarePosition[0])
|
||||
{
|
||||
if (mY > SFG_player.squarePosition[1])
|
||||
@ -1306,6 +1316,19 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// exploder explodes
|
||||
|
||||
uint8_t properties;
|
||||
|
||||
SFG_TileDefinition tile =
|
||||
SFG_getMapTile(SFG_currentLevel.levelPointer,mX,mY,&properties);
|
||||
|
||||
SFG_createExplosion(mX * RCL_UNITS_PER_SQUARE ,mY * RCL_UNITS_PER_SQUARE,
|
||||
SFG_TILE_FLOOR_HEIGHT(tile) * SFG_WALL_HEIGHT_STEP + SFG_WALL_HEIGHT_STEP);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ranged monsters choose direction randomly
|
||||
|
||||
@ -1510,6 +1533,8 @@ void SFG_playerChangeHealth(int8_t healthAdd)
|
||||
|
||||
void SFG_createExplosion(RCL_Unit x, RCL_Unit y, RCL_Unit z)
|
||||
{
|
||||
printf("%d %d %d\n",x,y,z);
|
||||
|
||||
SFG_ProjectileRecord explostion;
|
||||
|
||||
explostion.type = SFG_PROJECTILE_EXPLOSION;
|
||||
|
Loading…
Reference in New Issue
Block a user