Graphically, the unit ought to:
1) Always spin with a constant period.
2) Have no hitches in any and all animation transitions.
3) Spin during all animations.
So basically this unit we have in mind always spins. When it attacks, it doesn't stop spinning. When it moves or comes to a stop, it still spins.
I thought this sort of unit would be easy to implement.
It turns out I was wrong.
Here is the "base" unit:
Code
.headerstart
IsId 68
Type 12
Init AK_InvisBase_Init
Death AK_InvisBase_Death
GndAttkInit AK_InvisBase_GndAttkInit
AirAttkInit AK_InvisBase_GndAttkInit
Unused1 [NONE]
GndAttkRpt AK_InvisBase_GndAttkInit
AirAttkRpt AK_InvisBase_GndAttkInit
CastSpell [NONE]
GndAttkToIdle AK_InvisBase_GndAttkToIdle
AirAttkToIdle AK_InvisBase_GndAttkToIdle
Unused2 [NONE]
Walking AK_InvisBase_Walking
WalkingToIdle AK_InvisBase_WalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #
AK_InvisBase_Init:
# Spawn actual thing
#sprol 247 0 0
imgol 261 0 0
playfram 0x00 # frame set 0
tmprmgraphicstart
goto AK_InvisBase_WalkingToIdle
AK_InvisBase_GndAttkToIdle:
AK_InvisBase_WalkingToIdle:
wait 125
goto AK_InvisBase_WalkingToIdle
AK_InvisBase_GndAttkInit:
wait 1
attack
gotorepeatattk
goto AK_InvisBase_GndAttkToIdle
AK_InvisBase_Death:
wait 3
end
AK_InvisBase_Walking:
goto AK_InvisBase_WalkingToIdle
IsId 68
Type 12
Init AK_InvisBase_Init
Death AK_InvisBase_Death
GndAttkInit AK_InvisBase_GndAttkInit
AirAttkInit AK_InvisBase_GndAttkInit
Unused1 [NONE]
GndAttkRpt AK_InvisBase_GndAttkInit
AirAttkRpt AK_InvisBase_GndAttkInit
CastSpell [NONE]
GndAttkToIdle AK_InvisBase_GndAttkToIdle
AirAttkToIdle AK_InvisBase_GndAttkToIdle
Unused2 [NONE]
Walking AK_InvisBase_Walking
WalkingToIdle AK_InvisBase_WalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #
AK_InvisBase_Init:
# Spawn actual thing
#sprol 247 0 0
imgol 261 0 0
playfram 0x00 # frame set 0
tmprmgraphicstart
goto AK_InvisBase_WalkingToIdle
AK_InvisBase_GndAttkToIdle:
AK_InvisBase_WalkingToIdle:
wait 125
goto AK_InvisBase_WalkingToIdle
AK_InvisBase_GndAttkInit:
wait 1
attack
gotorepeatattk
goto AK_InvisBase_GndAttkToIdle
AK_InvisBase_Death:
wait 3
end
AK_InvisBase_Walking:
goto AK_InvisBase_WalkingToIdle
And here is the "turret" image animation:
Code
.headerstart
IsId 89
Type 12
Init AK_Graphic_Init
Death AK_Graphic_Death
GndAttkInit AK_Graphic_WalkingToIdle
AirAttkInit AK_Graphic_WalkingToIdle
Unused1 [NONE]
GndAttkRpt AK_Graphic_WalkingToIdle
AirAttkRpt AK_Graphic_WalkingToIdle
CastSpell [NONE]
GndAttkToIdle AK_Graphic_WalkingToIdle
AirAttkToIdle AK_Graphic_WalkingToIdle
Unused2 [NONE]
Walking AK_Graphic_WalkingToIdle
WalkingToIdle AK_Graphic_WalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #
AK_Graphic_Init:
imgul 224 0 42 # AK_Graphic_Shad (terran\AK_Graphic_.grp)
playfram 0x00 # frame set 0
goto AK_Graphic_WalkingToIdle
AK_Graphic_GndAttkToIdle:
AK_Graphic_WalkingToIdle:
playfram 0x0
wait 2
playfram 0x1
wait 2
playfram 0x2
wait 2
playfram 0x3
wait 2
playfram 0x4
wait 2
playfram 0x5
wait 2
playfram 0x6
wait 2
playfram 0x7
wait 2
playfram 0x8
wait 2
playfram 0x9
wait 2
playfram 0xa
wait 2
playfram 0xb
wait 2
playfram 0xc
wait 2
playfram 0xd
wait 2
playfram 0xe
wait 2
playfram 0xf
wait 2
goto AK_Graphic_WalkingToIdle
AK_Graphic_GndAttkInit:
wait 1
goto AK_Graphic_GndAttkToIdle
AK_Graphic_Death:
playsnd 210 # Terran\DROPSHIP\TDrDth00.wav
imgol 215 0 0 # Protoss Large Explosion
imgol 333 0 0 # TerranBuildingExplosionmedium (thingy\tBangL.grp)
wait 3
end
AK_Graphic_Walking:
goto AK_Graphic_WalkingToIdle
IsId 89
Type 12
Init AK_Graphic_Init
Death AK_Graphic_Death
GndAttkInit AK_Graphic_WalkingToIdle
AirAttkInit AK_Graphic_WalkingToIdle
Unused1 [NONE]
GndAttkRpt AK_Graphic_WalkingToIdle
AirAttkRpt AK_Graphic_WalkingToIdle
CastSpell [NONE]
GndAttkToIdle AK_Graphic_WalkingToIdle
AirAttkToIdle AK_Graphic_WalkingToIdle
Unused2 [NONE]
Walking AK_Graphic_WalkingToIdle
WalkingToIdle AK_Graphic_WalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #
AK_Graphic_Init:
imgul 224 0 42 # AK_Graphic_Shad (terran\AK_Graphic_.grp)
playfram 0x00 # frame set 0
goto AK_Graphic_WalkingToIdle
AK_Graphic_GndAttkToIdle:
AK_Graphic_WalkingToIdle:
playfram 0x0
wait 2
playfram 0x1
wait 2
playfram 0x2
wait 2
playfram 0x3
wait 2
playfram 0x4
wait 2
playfram 0x5
wait 2
playfram 0x6
wait 2
playfram 0x7
wait 2
playfram 0x8
wait 2
playfram 0x9
wait 2
playfram 0xa
wait 2
playfram 0xb
wait 2
playfram 0xc
wait 2
playfram 0xd
wait 2
playfram 0xe
wait 2
playfram 0xf
wait 2
goto AK_Graphic_WalkingToIdle
AK_Graphic_GndAttkInit:
wait 1
goto AK_Graphic_GndAttkToIdle
AK_Graphic_Death:
playsnd 210 # Terran\DROPSHIP\TDrDth00.wav
imgol 215 0 0 # Protoss Large Explosion
imgol 333 0 0 # TerranBuildingExplosionmedium (thingy\tBangL.grp)
wait 3
end
AK_Graphic_Walking:
goto AK_Graphic_WalkingToIdle
Here's what I have tried:
1) Implementing via one unit with no spawned overlays.
2) One unit spawning an image overlay.
3) One unit spawning a sprite overlay.
The problem with (2) is that the unit will reset its very simple spinning animation every time it transitions from attacking to moving, from moving to stopping, from stop to moving, from stop to attack, from attack to stop, etc, producing a noticeable and annoying "hitch," stall, or jerk.
The problem with (3) is that the sprite overlay will not follow the unit (so one could see the selection circle moving about, but the graphic remains spinning in place where the unit was created).
So the question is simple: How does one implement such a spinning unit flawlessly (or at least mostly flawlessly)?