This is for the love2d engine. Works with the latest version. Look at my intro to software project for some examples on how to use this
5 lines
143 B
Plaintext
5 lines
143 B
Plaintext
function InGridY(i,w,h,xs,ys)
|
|
local xc,yc=math.floor(w/xs),math.floor(h/ys)
|
|
local xi,yi=math.floor((i-1)/yc),(i-1)%yc
|
|
return xi*xs,yi*ys
|
|
end |