SUB DrawSprite
(Lx%
, Ly%
, Mx~%%
, MY~%%
, Scale%%
) 'get the end map displayed based on scale
Fx~%% = Mx~%% + (29 \ Scale%%)
Fy~%% = My~%% + (21 \ Scale%%)
SELECT CASE Unit
(0).Movement.IDmark
'Unit(0) sprite layout CASE Peasant
, Peon
, Grunt
, Archer
, Spearman
, Knight
, Cleric
, Necrolyte
, Conjurer
, Warlock
SELECT CASE Unit
(0).Movement.Direction
'get base sprite offsets SpriteX1% = 0
SpriteY1% = 0
SpriteX2% = 31
SpriteY2% = 31
SpriteX1% = 32
SpriteY1% = 0
SpriteX2% = 63
SpriteY2% = 31
SpriteX1% = 64
SpriteY1% = 0
SpriteX2% = 95
SpriteY2% = 31
SpriteX1% = 96
SpriteY1% = 0
SpriteX2% = 127
SpriteY2% = 31
SpriteX1% = 128
SpriteY1% = 0
SpriteX2% = 159
SpriteY2% = 31
SpriteX1% = 127
SpriteY1% = 0
SpriteX2% = 96
SpriteY2% = 31
SpriteX1% = 95
SpriteY1% = 0
SpriteX2% = 64
SpriteY2% = 31
SpriteX1% = 63
SpriteY1% = 0
SpriteX2% = 32
SpriteY2% = 31
SELECT CASE Unit
(0).Act
'adjust based on unit action CASE Still
' unit is not performing an action CASE Moving
' unit is walking SpriteX1% = SpriteX1%
SpriteY1% = SpriteY1% + 32 * Anima(0, Unit(0).Movement.Frame)
SpriteX2% = SpriteX2%
SpriteY2% = SpriteY2% + 32 * Anima(0, Unit(0).Movement.Frame)
Unit(0).Movement.Frame = Unit(0).Movement.Frame + 1
IF Unit
(0).Movement.Frame
= 8 THEN Unit
(0).Movement.Frame
= 0 CASE Mining
' unit is in mine and hidden Peasant+Peon only CASE LumberJack
' unit is chopping wood Peasant+Peon only SpriteX1% = SpriteX1% + 160
SpriteY1% = SpriteY1% + 32 * Anima(Unit(0).Movement.IDmark, Unit(0).Movement.Frame)
SpriteX2% = SpriteX2% + 160
SpriteY2% = SpriteY2% + 32 * Anima(Unit(0).Movement.IDmark, Unit(0).Movement.Frame)
Unit(0).Movement.Frame = Unit(0).Movement.Frame + 1
IF Unit
(0).Movement.Frame
= 8 THEN Unit
(0).Movement.Frame
= 0 CASE CarryGold
' unit is carrying bag of gold Peasant+Peon only SpriteX1% = SpriteX1%
SpriteY1% = SpriteY1% + 320 + 32 * Anima(0, Unit(0).Movement.Frame)
SpriteX2% = SpriteX2%
SpriteY2% = SpriteY2% + 320 + 32 * Anima(0, Unit(0).Movement.Frame)
Unit(0).Movement.Frame = Unit(0).Movement.Frame + 1
IF Unit
(0).Movement.Frame
= 8 THEN Unit
(0).Movement.Frame
= 0 CASE CarryWood
' unit is carrying a stack of wood Peasant+Peon only SpriteX1% = SpriteX1%
SpriteY1% = SpriteY1% + 160 + 32 * Anima(0, Unit(0).Movement.Frame)
SpriteX2% = SpriteX2%
SpriteY2% = SpriteY2% + 160 + 32 * Anima(0, Unit(0).Movement.Frame)
Unit(0).Movement.Frame = Unit(0).Movement.Frame + 1
IF Unit
(0).Movement.Frame
= 8 THEN Unit
(0).Movement.Frame
= 0 CASE Attacking
' unit is attacking CASE Shooting
' unit is shooting a projectile CASE Casting
' unit is casting a spell CASE Decomposing
'unit is dead SpriteX1% = 0
SpriteY1% = 0
SpriteX2% = 47
SpriteY2% = 47
SpriteX1% = 48
SpriteY1% = 0
SpriteX2% = 95
SpriteY2% = 47
SpriteX1% = 96
SpriteY1% = 0
SpriteX2% = 143
SpriteY2% = 47
SpriteX1% = 144
SpriteY1% = 0
SpriteX2% = 191
SpriteY2% = 47
SpriteX1% = 192
SpriteY1% = 0
SpriteX2% = 239
SpriteY2% = 47
SpriteX1% = 191
SpriteY1% = 0
SpriteX2% = 144
SpriteY2% = 47
SpriteX1% = 143
SpriteY1% = 0
SpriteX2% = 96
SpriteY2% = 47
SpriteX1% = 95
SpriteY1% = 0
SpriteX2% = 48
SpriteY2% = 47
if Unit
(0).Movement.MapX
< Mx~%%
or Unit
(0).Movement.MapX
> Fx~%%
or Unit
(0).Movement.MapY
< My~%%
or Unit
(0).Movement.MapY
> Fy~%%
then 'unit is not in view
L%% = Unit(0).Movement.IDmark
UXpos%=Lx%+ ( (Unit(0).Movement.MapX - Mx~%%) * (16*Scale%%) )
UYpos%=Ly%+ ( (Unit(0).Movement.MapY - My~%%) * (16*Scale%%) )
_PUTIMAGE (UXpos%
, UYpos%
), Layer
(L%%
), _DISPLAY, (SpriteX1%
, SpriteY1%
)-(SpriteX2%
, SpriteY2%
)