I find the syntax of **sspr** involves too much work, so I wrote a wrapper function that requires less arguments and less thinking.

Ladies and gentlemen... zspr

Arguments:

--n: standard sprite number

--w: number of sprite blocks wide to grab

--h: number of sprite blocks high to grab

--dx: destination x coordinate

--dy: destination y coordinate

--dz: destination scale/zoom factor

function zspr(n,w,h,dx,dy,dz) sx = 8 * (n % 16) sy = 8 * flr(n / 16) sw = 8 * w sh = 8 * h dw = sw * dz dh = sh * dz sspr(sx,sy,sw,sh, dx,dy,dw,dh) end |

Please let me know if you find it useful.

this function is actually slightly incorrect

sx = (n % 16)

sy = flr(n/16)

sx *= 8
sy *= 8

Here's something for a flipping change!

--https://www.lexaloffle.com/bbs/?tid=2429

function zspr(n,w,h,dx,dy,dz,fx,fy)

local sx = 8 * (n % 16)
local sy = 8 * flr(n / 16)

local sw = 8

*w*

local sh = 8h

local sh = 8

local dw = sw

*dz*

local dh = shdz

local dh = sh

sspr(sx,sy,sw,sh,dx,dy,dw,dh,fx,fy)

end

Re-posting @acepek's version in a code block, as otherwise the formatting breaks it! ðŸ˜‰

--https://www.lexaloffle.com/bbs/?tid=2429 function zspr(n,w,h,dx,dy,dz,fx,fy) local sx = 8 * (n % 16) local sy = 8 * flr(n / 16) local sw = 8 * w local sh = 8 * h local dw = sw * dz local dh = sh * dz sspr(sx,sy,sw,sh,dx,dy,dw,dh,fx,fy) end |

Freds is right, just put it all inline!

function zspr(n,w,h,dx,dy,dz,fx,fy) sspr(8*(n%16),8*flr(n/16),8*w,8*h,dx,dy,8*w*dz,8*h*dz,fx,fy) end |

[Please log in to post a comment]