private void DrawCreatures(SpriteBatch spriteBatch) { int tilesize = Constants.TileSize; int offset = tilesize / 4; // CREATURES foreach (KeyValuePair <UInt32, Creature> kvp in _currentMap.Menagerie) { Creature tenant = kvp.Value; Texture2D tenantBitmap = _creatures[(sbyte)tenant.MyBitmap]; Int32 i = tenant.PositionGet().X; Int32 j = tenant.PositionGet().Y; Int16 visibilityTracker = _currentMap.MyVisibilityTracker.VisibilityCheck(tenant.PositionGet(), _myGame.PlayerTeam); Vector2 pos = new Vector2(i * tilesize + (j % 2) * (tilesize / 2), j * tilesize - j * offset) + _screenAnchor; Rectangle rectHex = ZoomTransform(new Rectangle((int)pos.X, (int)pos.Y, tilesize, tilesize)); Rectangle rectCreature = ZoomTransform(new Rectangle((int)pos.X, (int)pos.Y, tenantBitmap.Width, tenantBitmap.Height)); if (tenant != null && (tenant.Team == _myGame.PlayerTeam || visibilityTracker > 0)) { // if the tenant is selected, draw selection box if (_myInterface.SelectedCreature == tenant) { spriteBatch.Draw(_tiles[(sbyte)SpriteTile.HexRed], rectHex, Color.White); } // if the tenant is an enemy and within range of a friendly selected creature, draw an indication if (_myInterface.SelectedCreature != null && _myInterface.SelectedCreature.Team == _myGame.PlayerTeam && tenant.Team != _myGame.PlayerTeam && _myInterface.SelectedCreature.GetAttackRange() >= StaticMathFunctions.DistanceBetweenTwoCoordsHex(_myInterface.SelectedCreature.PositionGet(), tenant.PositionGet())) { spriteBatch.Draw(_tiles[(sbyte)SpriteTile.HexRed], rectHex, Color.Red); } // If there is an active animation for the creature, draw it. if (_creatureAnimations.ContainsKey(tenant.UniqueID)) { List <AnimUnitMove> currentStack = _creatureAnimations[tenant.UniqueID]; AnimUnitMove current = currentStack.Last(); current.Draw(spriteBatch, _screenAnchor, Color.White, _zoom); } // Otherwise, draw static sprite of the creature. else { spriteBatch.Draw(_creatures[(sbyte)tenant.MyBitmap], rectCreature, Color.White); //HP bar: float hpRatio = (float)tenant.GetHP() / (float)tenant.GetHPMax(); Vector2 barLocation = pos; barLocation.X += 3 * Constants.TileSize / 4; barLocation.Y += (1 - hpRatio) * Constants.TileSize; Color drawColor = Color.Lerp(Color.Red, Color.Green, hpRatio); drawColor.A = 64; spriteBatch.Draw(_particles[(sbyte)SpriteParticle.ParticlePixel], ZoomTransform(new Rectangle((int)barLocation.X, (int)barLocation.Y, Constants.TileSize / 12, (int)(hpRatio * Constants.TileSize))), drawColor); } } } }