11-27-2025, 02:09 PM
Why would anyone use a loop to find a sprite on a sprite sheet? Its a direct calculation.
And what does creating a bunch of random points have to do with locating a sprite?
Direct Calculation:
let SW = sprite width, SH sprite height, SPR sprites per row, SPC sprites per column
let I be the sprite index of interest
let SX, SY be the top left pixel of Sprite I
then
SX = (I mod SPC) * SW
SY = int(I / SPR) * SH
Simple (for someone who has done it dozens of times.)
And what does creating a bunch of random points have to do with locating a sprite?
Direct Calculation:
let SW = sprite width, SH sprite height, SPR sprites per row, SPC sprites per column
let I be the sprite index of interest
let SX, SY be the top left pixel of Sprite I
then
SX = (I mod SPC) * SW
SY = int(I / SPR) * SH
Simple (for someone who has done it dozens of times.)
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever

