Hi guys, sorry for stupid questions , but yesterday evening I thought about this technic :“I have some npc’s positioned in big sprite with some pixels between them. And I want randomly chose one piece of big image and use that piece like single image” . I have some experience in modding mobile games and I remember that technic uses in animation (for example) . I imagine make some “railing” to divorce sprites from whole image. Maybe only cut sprite from image to store in memory . All in all I want know your opinions
P.s I think it needs 2d table
P.s.s sorry for my English
@lupino8211 what you’re looking for is either a shader (which is harder, I do not recommend it), or setContext(img).
Say your big image is 1600x800 and you want to display 8 different 400x400 images you would do something like this
local img = image(400,400)
setContext(img)
--this draws the top left of the big image
sprite(bigimg,800,0)
setContext()
So what is happening is you’re just drawing to that one image that is 400x400, but when doing this your coordinates now default around 0,0 which is the bottom left of your 400x400 picture, meaning you’ll have to work out the position of the big sprite based around that 0,0 coordinate.
You can make a table of positions for the bigimg and increment through the table to create animation or just store several images in one big sprite, the possibilities are endless (not literally).