d~&
= point(0, 0) ' Detection colors = sprite_count + 1
x1 = 1 ' Top left of first sprite in sheet
y1 = 2
sprite(s).image = i&
' Source position
' #1 Sprite size
x2 = scan_right(x1, y1, i&, d~&)
y2 = scan_down(x1, y1, i&, d~&)
sprite(s).size.x = x2 - x1 - 1
sprite(s).size.y = y2 - y1 - 1
' #2 Animation frame count
x2 = scan_right(x2, y1, i&, d~&)
sprite
(s
).frames
= int( ((x2
+ 1) - x1
) / (sprite
(s
).size.x
+ 2) ) if sprite
(s
).frames
< 1 then sprite
(s
).frames
= 1
' #3 Frame counter ticks per animation frame
sprite(s).fpf = scan_right(x2, y1 - 1, i&, d~&) - x2
if sprite
(s
).fpf
< 1 then sprite
(s
).fpf
= 1 x2 = x2 + 1
' #4 Sprite display position - relative to hitbox position
x_hb = scan_right(x2 - 1, y1, i&, d~&)
y_hb = scan_down(x2, y1 - 1, i&, d~&)
sprite(s).offset.x = x2 - x_hb
sprite(s).offset.y = y1 - y_hb
' NOTE If either offset is zero, this forces the other one to be zero as well
' Easy fix is to move the detection pixels outside the sprite area
' #5 Hitbox size
sprite(s).hb_size.x = scan_right(x_hb, y1, i&, d~&) - x_hb
sprite(s).hb_size.y = scan_down(x2, y_hb, i&, d~&) - y_hb
y1 = y2 + 1
y1 = 2
x1 = scan_right(x1, 0, i&, d~&) + 1 ' Find new column
s = s + 1
sprite_count = s