Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Today I learned loops are slow
#4
S'OK live and learn, give my little forumlas a test, might be helpful to you Smile

The sprite index assumes numbering the sprites left to right, top to bottom starting at 0 for first sprite. I would prefer starting at 1 so the top index is the number of sprites but that complicates the math a bit.

So top index is SPR * SPC -1, minus 1 because we start at 0.

Mod is modulus = the remainder left after dividing index by SPC (sprites per...

Dang I think I switched SPR with SPC, oops sorry
SX = (I mod SPR) * SW
SY = int(I / SPC) * SH

Sprites per row, SPR, is how many sprites across the sheet
Sprites per column, SPC, is how many sprites down the sheet

I will dig up an old proggie to verify these...
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Today I learned loops are slow - by CMR - 11-27-2025, 05:20 AM
RE: Today I learned loops are slow - by bplus - 11-27-2025, 02:09 PM
RE: Today I learned loops are slow - by CMR - 11-27-2025, 05:20 PM
RE: Today I learned loops are slow - by bplus - 11-27-2025, 06:27 PM
RE: Today I learned loops are slow - by bplus - 11-27-2025, 07:17 PM
RE: Today I learned loops are slow - by CMR - 11-27-2025, 08:35 PM
RE: Today I learned loops are slow - by bplus - 11-27-2025, 09:17 PM
RE: Today I learned loops are slow - by Pete - 11-27-2025, 10:52 PM
RE: Today I learned loops are slow - by CMR - 11-28-2025, 01:58 AM
RE: Today I learned loops are slow - by TDarcos - 12-20-2025, 02:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I have learned something new: how to get a run-time syntax error TDarcos 2 1,003 10-02-2024, 07:04 PM
Last Post: TDarcos
  A little bit of spark fun today TerryRitchie 2 861 05-18-2024, 12:59 AM
Last Post: bobalooie
  Loops alternate recursive ways bplus 10 2,096 02-01-2023, 02:05 PM
Last Post: Dimster

Forum Jump:


Users browsing this thread: 1 Guest(s)