You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something I noticed happening on all my characters whenever I used the sequential projectile animation.
Their weapons would be correctly aligned during the first frame but lowered on the second one, don't know if this is intentional or not, seeing as it only happens with sequential projectiles.
The text was updated successfully, but these errors were encountered:
In battles, the state of heroes, enemies, attack graphics and the weapon are stored in the bslot() array, which is an array of BattleSprites. bslot 0-3 are heroes, 4-11 enemies, 12-23 attack sprites (just 12 is used for most attacks), and bslot(24) is the weapon. (BattleSprite has a huge amount of state including a lot of data copied from EnemyDef, but only the graphical stuff is relevant to attacks and weapons).
anim_hero animates and positions the hero and the weapon during an attack. Specifically, the second weapon frame:
hand = gam.hero(who).hand_pos(1)
wep = bslot(24).hand(1)
wepoff = hand - wep
anim_align2 24, who, 0, 0, wepoff.x, 16 # Sets weapon X and Y relative to the attacker, 'who'
anim_setz 24, 16 - wepoff.y
anim_setframe 24, 1
(anim_* functions queue up animation commands at the beginning of an attack, and then they are executed by battle_attack_anim_playback.)
Note it doesn't depend on the attack animation, suggesting the weapon position is getting overwritten afterwards.
The attack animations are implemented in generate_atkscript, which call anim_hero. Looking at the implementation of Sequential Projectile for places it affects BattleSprite 24, there is one such obvious line. However I also noticed the line anim_setz 12 + i, projectile_start.z
where i is used uninitialised! It turns out the previous use was in a FOR i = 0 to 11 loop, so 12 + i = 24 and that's the cause of the bug.
This is something I noticed happening on all my characters whenever I used the sequential projectile animation.
Their weapons would be correctly aligned during the first frame but lowered on the second one, don't know if this is intentional or not, seeing as it only happens with sequential projectiles.
The text was updated successfully, but these errors were encountered: