I know what you mean, but it still doesn't make sense...
Take, for instance, the original script... don't even worry about the extra movement frames add-on, but take a look here at the original...
under Sprite_Character
#--------------------------------------------------------------------------
# * Update Transfer Origin Rectangle
#--------------------------------------------------------------------------
def update_src_rect
if @tile_id == 0
index = @character.character_index
pattern = @character.pattern < 3 ? @character.pattern : 1 # <-- Huh?
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
Not sure what's going on in the 4th line. If I had to guess, pattern = character.pattern 1 (what is the : for?) unless character.pattern is less than 3... yeah I'm not complete in my search for ruby knowledge. I've seen ? before, sort of like an "if" on the fly... but ":" escapes me at the moment... could this be the answer, I wonder..
(edit:) Hm actually... it seems this means: pattern = @character.pattern if @character.pattern is less than 3, otherwise pattern = 1. I am more confused than before, now.
Anyway...
Under Game_Character...
#--------------------------------------------------------------------------
# * Update Animation Count
#--------------------------------------------------------------------------
def update_animation
speed = @move_speed + (dash? ? 1 : 0)
if @anime_count > 18 - speed * 2
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % 4
end
@anime_count = 0
end
end
Follows the same formula, but modulus 4... and since @original_pattern = 1...
pattern = (pattern + 1) % 4
2
pattern = (pattern + 1) % 4
3
pattern = (pattern + 1) % 4
0
pattern = (pattern + 1) % 4
1
So... there are actually 4 patterns, even though in a character file you only have 3 frames horizontally... this tells me patterns are stored in a sequence somewhere. And the game seems to play them in the order of 1, 2, 1, 0, repeat... because 1, 2, 0, 1 ... would look ridiculous... hope I'm making sense there...
The question is, where is this sequence being stored, and how is the 1 2 1 0... order determined? This turned out more complicated than it seemed, I think....
Hm... maybe this is it, then...
okay, say @original_pattern = 1, which it is by default (the "standing" frame, the one in the middle... the one on the left is 0, and the one on the right is 2)...
the modulus division keeps the pattern incrementing by 1... BUT... this line here...
pattern = @character.pattern < 3 ? @character.pattern : 1
This means that if the current pattern is 3 or more, then use pattern 1...
So, with that...
1..2..NOT 3, BUT 1, since 3 is NOT less than 3...0...1
So the pattern is 1 2 1 0... repeat...
Now, this works fine with default character sets... and I could be wrong here, but what do you think? Am I onto something?