Goooooood Morning / Timezone everyone!
I'm currently looking into drawing some custom icons on the Party Command Window, so figured I'd start my learning by breaking down how icons are drawn (by default) on the Window_BattleStatus window.
Here's what I've deciphered so far:
.
So, as you can (probably) see, I have a couple of questions / things that are stumping me:
1) Does anyone know what the "[0, width / 24]" bit of code is doing and HOW it is doing it?
i ) When I comment it out, if you have 3 or more state icons active... then the third icon onwards start appearing behind the HP numbers and gauge.
ii ) So I know it has something to do with limiting the amount of visible state icons to 2 (so they don't run behind the other graphics like the HP gauge), but, again, I'm not really sure what it's interacting with to do that. Any thoughts?
2) When it comes to math, can anyone help me understand the "x + 24 * i" equation?
i ) I know it's to do with spacing the icons out a bit so they don't overlap eachother, but I don't really understand the math.
.
.
Thanks for any help!
🙂
I'm currently looking into drawing some custom icons on the Party Command Window, so figured I'd start my learning by breaking down how icons are drawn (by default) on the Window_BattleStatus window.
Here's what I've deciphered so far:
Ruby:
#--------------------------------------------------------------------------
# * Draw State and Buff/Debuff Icons
#--------------------------------------------------------------------------
def draw_actor_icons(actor, x, y, width = 96)
# draw_actor_icons method, takes in arguments: actor, x, y, width
# width by default is 96 if not overwritten
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
# local variable icons = actor's state_icons (array of icon numbers) +
# actor's buff icons.
# But how does "[0, width / 24]" work?
icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
# for each value in the icons array that has an index number:
# assign n to one then i to another, then draw the icon from the bitmap where:
# icon_index = n, x = x + 24 * i, y = y
#
end
So, as you can (probably) see, I have a couple of questions / things that are stumping me:
1) Does anyone know what the "[0, width / 24]" bit of code is doing and HOW it is doing it?
i ) When I comment it out, if you have 3 or more state icons active... then the third icon onwards start appearing behind the HP numbers and gauge.
ii ) So I know it has something to do with limiting the amount of visible state icons to 2 (so they don't run behind the other graphics like the HP gauge), but, again, I'm not really sure what it's interacting with to do that. Any thoughts?
.
2) When it comes to math, can anyone help me understand the "x + 24 * i" equation?
i ) I know it's to do with spacing the icons out a bit so they don't overlap eachother, but I don't really understand the math.
.
.
.
Thanks for any help!
🙂