Page 1 of 1
ArrayList Of pictures for a snake game ?
Posted: Thu Feb 16, 2017 7:50 pm
by Mi4_Slayer
I am trying to make a snake game .... without the rectangle function. But most guide use rectangle. So I wanna know if I can make a array with pictures
Re: ArrayList Of pictures for a snake game ?
Posted: Thu Feb 16, 2017 11:22 pm
by raidho36
Sure you can fill your grid with Image references. Then you draw the whole thing by iterating over each row in each column (or the other way around) and draw the Image in that grid cell. Just don't create new Images every time you change cell image, instead create your Images on load and then put references to those images into the grid.
Code: Select all
local image1 = love.graphics.newImage ( "snake123.png" )
--[[ ]]--
grid[ x ][ y ] = image1
--[[ ]]--
love.graphics.draw ( grid[ x ][ y ], xx, yy )