diff --git a/assets.h b/assets.h index 08d8f28..de56335 100644 --- a/assets.h +++ b/assets.h @@ -727,6 +727,13 @@ uint8_t SFG_weaponImages[][SFG_TEXTURE_SIZE * SFG_TEXTURE_SIZE] = } }; +/* TODO: ENEMIES: create a functions that will take enemy ID and frame type +(idle, attacking, ...) and will return pointer to sprite representing it -- +allows reusing sprites and saving memory (e.g. a fyling monster can have same +frame for idle and walking, some enemies can share the same dead sprite etc.). +Also: add flip option to sprite drawing function so that some frames can be +reused flipped (good for walk anims). */ + uint8_t SFG_charToFontIndex(char c) { if (c >= 'a' && c <= 'z') diff --git a/main.c b/main.c index ad8f60f..18485d0 100755 --- a/main.c +++ b/main.c @@ -1177,11 +1177,16 @@ void SFG_gameStep() SFG_currentLevel.levelPointer->elements[item]; if ( - (RCL_absVal(SFG_player.squarePosition[0] - e.coords[0]) - <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE) + RCL_absVal(SFG_player.squarePosition[0] - e.coords[0]) + <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE && - (RCL_absVal(SFG_player.squarePosition[1] - e.coords[1]) - <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE) + RCL_absVal(SFG_player.squarePosition[1] - e.coords[1]) + <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE + && + RCL_absVal( + SFG_player.camera.height - + SFG_floorHeightAt(e.coords[0],e.coords[1])) + <= (SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE * RCL_UNITS_PER_SQUARE) ) item |= SFG_ITEM_RECORD_ACTIVE_MASK;