My game won't draw the images, but reports no errors

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
SooBaccaCole
Prole
Posts: 2
Joined: Fri Dec 30, 2016 5:06 am

My game won't draw the images, but reports no errors

Post by SooBaccaCole »

When programming a game of mine, I found that it wouldn't draw any of the images on-screen when ran. I'll post the source code here, so please read through it and tell me whether or not I am doing something wrong.

Code: Select all

--Functions--
function love.load()
	--Variables--
	pdir = "South"
	px = 2
	py = 2
	spriteanimcount = 0
	munahwhiteplayer1 = love.graphics.newImage("SIDHODMunWPlayerNoClass.png")
	playerimage = munahwhiteplayer1
	tree = love.graphics.newImage("SIDHODTree.png")
	wall = love.graphics.newImage("SIDHODWall.png")
	water1 = love.graphics.newImage("SIDHODWater1.png")
	water2 = love.graphics.newImage("SIDHODWater2.png")
	--Lists--
	room = {
		x1y1 = "tree",
		x2y1 = "tree",
		x3y1 = "tree",
		x4y1 = "tree",
		x5y1 = "tree",
		x6y1 = "tree",
		x7y1 = "tree",
		x8y1 = "tree",
		x9y1 = "tree",
		x10y1 = "tree",
		x1y2 = "tree",
		x2y2 = "none",
		x3y2 = "none",
		x4y2 = "none",
		x5y2 = "none",
		x6y2 = "none",
		x7y2 = "none",
		x8y2 = "none",
		x9y2 = "none",
		x10y2 = "tree",
		x1y3 = "tree",
		x2y3 = "none",
		x3y3 = "none",
		x4y3 = "none",
		x5y3 = "none",
		x6y3 = "none",
		x7y3 = "none",
		x8y3 = "none",
		x9y3 = "none",
		x10y3 = "tree",
		x1y4 = "tree",
		x2y4 = "none",
		x3y4 = "none",
		x4y4 = "none",
		x5y4 = "none",
		x6y4 = "none",
		x7y4 = "none",
		x8y4 = "none",
		x9y4 = "none",
		x10y4 = "tree",
		x1y5 = "tree",
		x2y5 = "none",
		x3y5 = "none",
		x4y5 = "none",
		x5y5 = "none",
		x6y5 = "none",
		x7y5 = "none",
		x8y5 = "none",
		x9y5 = "none",
		x10y5 = "tree",
		x1y6 = "tree",
		x2y6 = "none",
		x3y6 = "none",
		x4y6 = "none",
		x5y6 = "none",
		x6y6 = "none",
		x7y6 = "none",
		x8y6 = "none",
		x9y6 = "none",
		x10y6 = "tree",
		x1y7 = "tree",
		x2y7 = "none",
		x3y7 = "none",
		x4y7 = "none",
		x5y7 = "none",
		x6y7 = "none",
		x7y7 = "none",
		x8y7 = "none",
		x9y7 = "none",
		x10y7 = "tree",
		x1y8 = "tree",
		x2y8 = "none",
		x3y8 = "none",
		x4y8 = "none",
		x5y8 = "none",
		x6y8 = "none",
		x7y8 = "none",
		x8y8 = "none",
		x9y8 = "none",
		x10y8 = "tree",
		x1y9 = "tree",
		x2y9 = "none",
		x3y9 = "none",
		x4y9 = "none",
		x5y9 = "none",
		x6y9 = "none",
		x7y9 = "none",
		x8y9 = "none",
		x9y9 = "none",
		x10y9 = "tree",
		x1y10 = "tree",
		x2y10 = "tree",
		x3y10 = "tree",
		x4y10 = "tree",
		x5y10 = "tree",
		x6y10 = "tree",
		x7y10 = "tree",
		x8y10 = "tree",
		x9y10 = "tree",
		x10y10 = "tree"
	}
end
function pcollide()
	if pdir == "South" then
		py = py - 1
	elseif pdir == "East" then
		px = px - 1
	elseif pdir == "West" then
		px = px + 1
	elseif pdir == "North" then
		py = py + 1
	end
end
function roomcollidecheck(roomname)
	if roomname == "tree" then
		pcollide()
	elseif roomname == "wall" then
		pcollide()
	elseif roomname == "water" then
		pcollide()
	end
end
function playercollidecheck()
	if px == 1 then
		if py == 1 then
			roomcollidecheck(room.x1y1)
		elseif py == 2 then
			roomcollidecheck(room.x1y2)
		elseif py == 3 then
			roomcollidecheck(room.x1y3)
		elseif py == 4 then
			roomcollidecheck(room.x1y4)
		elseif py == 5 then
			roomcollidecheck(room.x1y5)
		elseif py == 6 then
			roomcollidecheck(room.x1y6)
		elseif py == 7 then
			roomcollidecheck(room.x1y7)
		elseif py == 8 then
			roomcollidecheck(room.x1y8)
		elseif py == 9 then
			roomcollidecheck(room.x1y9)
		elseif py == 10 then
			roomcollidecheck(room.x1y10)
		end
	elseif px == 2 then
		if py == 1 then
			roomcollidecheck(room.x2y1)
		elseif py == 2 then
			roomcollidecheck(room.x2y2)
		elseif py == 3 then
			roomcollidecheck(room.x2y3)
		elseif py == 4 then
			roomcollidecheck(room.x2y4)
		elseif py == 5 then
			roomcollidecheck(room.x2y5)
		elseif py == 6 then
			roomcollidecheck(room.x2y6)
		elseif py == 7 then
			roomcollidecheck(room.x2y7)
		elseif py == 8 then
			roomcollidecheck(room.x2y8)
		elseif py == 9 then
			roomcollidecheck(room.x2y9)
		elseif py == 10 then
			roomcollidecheck(room.x2y10)
		end
	elseif px == 3 then
		if py == 1 then
			roomcollidecheck(room.x3y1)
		elseif py == 2 then
			roomcollidecheck(room.x3y2)
		elseif py == 3 then
			roomcollidecheck(room.x3y3)
		elseif py == 4 then
			roomcollidecheck(room.x3y4)
		elseif py == 5 then
			roomcollidecheck(room.x3y5)
		elseif py == 6 then
			roomcollidecheck(room.x3y6)
		elseif py == 7 then
			roomcollidecheck(room.x3y7)
		elseif py == 8 then
			roomcollidecheck(room.x3y8)
		elseif py == 9 then
			roomcollidecheck(room.x3y9)
		elseif py == 10 then
			roomcollidecheck(room.x3y10)
		end
	elseif px == 4 then
		if py == 1 then
			roomcollidecheck(room.x4y1)
		elseif py == 2 then
			roomcollidecheck(room.x4y2)
		elseif py == 3 then
			roomcollidecheck(room.x4y3)
		elseif py == 4 then
			roomcollidecheck(room.x4y4)
		elseif py == 5 then
			roomcollidecheck(room.x4y5)
		elseif py == 6 then
			roomcollidecheck(room.x4y6)
		elseif py == 7 then
			roomcollidecheck(room.x4y7)
		elseif py == 8 then
			roomcollidecheck(room.x4y8)
		elseif py == 9 then
			roomcollidecheck(room.x4y9)
		elseif py == 10 then
			roomcollidecheck(room.x4y10)
		end
	elseif px == 5 then
		if py == 1 then
			roomcollidecheck(room.x5y1)
		elseif py == 2 then
			roomcollidecheck(room.x5y2)
		elseif py == 3 then
			roomcollidecheck(room.x5y3)
		elseif py == 4 then
			roomcollidecheck(room.x5y4)
		elseif py == 5 then
			roomcollidecheck(room.x5y5)
		elseif py == 6 then
			roomcollidecheck(room.x5y6)
		elseif py == 7 then
			roomcollidecheck(room.x5y7)
		elseif py == 8 then
			roomcollidecheck(room.x5y8)
		elseif py == 9 then
			roomcollidecheck(room.x5y9)
		elseif py == 10 then
			roomcollidecheck(room.x5y10)
		end
	elseif px == 6 then
		if py == 1 then
			roomcollidecheck(room.x6y1)
		elseif py == 2 then
			roomcollidecheck(room.x6y2)
		elseif py == 3 then
			roomcollidecheck(room.x6y3)
		elseif py == 4 then
			roomcollidecheck(room.x6y4)
		elseif py == 5 then
			roomcollidecheck(room.x6y5)
		elseif py == 6 then
			roomcollidecheck(room.x6y6)
		elseif py == 7 then
			roomcollidecheck(room.x6y7)
		elseif py == 8 then
			roomcollidecheck(room.x6y8)
		elseif py == 9 then
			roomcollidecheck(room.x6y9)
		elseif py == 10 then
			roomcollidecheck(room.x6y10)
		end
	elseif px == 7 then
		if py == 1 then
			roomcollidecheck(room.x7y1)
		elseif py == 2 then
			roomcollidecheck(room.x7y2)
		elseif py == 3 then
			roomcollidecheck(room.x7y3)
		elseif py == 4 then
			roomcollidecheck(room.x7y4)
		elseif py == 5 then
			roomcollidecheck(room.x7y5)
		elseif py == 6 then
			roomcollidecheck(room.x7y6)
		elseif py == 7 then
			roomcollidecheck(room.x7y7)
		elseif py == 8 then
			roomcollidecheck(room.x7y8)
		elseif py == 9 then
			roomcollidecheck(room.x7y9)
		elseif py == 10 then
			roomcollidecheck(room.x7y10)
		end
	elseif px == 8 then
		if py == 1 then
			roomcollidecheck(room.x8y1)
		elseif py == 2 then
			roomcollidecheck(room.x8y2)
		elseif py == 3 then
			roomcollidecheck(room.x8y3)
		elseif py == 4 then
			roomcollidecheck(room.x8y4)
		elseif py == 5 then
			roomcollidecheck(room.x8y5)
		elseif py == 6 then
			roomcollidecheck(room.x8y6)
		elseif py == 7 then
			roomcollidecheck(room.x8y7)
		elseif py == 8 then
			roomcollidecheck(room.x8y8)
		elseif py == 9 then
			roomcollidecheck(room.x8y9)
		elseif py == 10 then
			roomcollidecheck(room.x8y10)
		end
	elseif px == 9 then
		if py == 1 then
			roomcollidecheck(room.x9y1)
		elseif py == 2 then
			roomcollidecheck(room.x9y2)
		elseif py == 3 then
			roomcollidecheck(room.x9y3)
		elseif py == 4 then
			roomcollidecheck(room.x9y4)
		elseif py == 5 then
			roomcollidecheck(room.x9y5)
		elseif py == 6 then
			roomcollidecheck(room.x9y6)
		elseif py == 7 then
			roomcollidecheck(room.x9y7)
		elseif py == 8 then
			roomcollidecheck(room.x9y8)
		elseif py == 9 then
			roomcollidecheck(room.x9y9)
		elseif py == 10 then
			roomcollidecheck(room.x9y10)
		end
	elseif px == 10 then
		if py == 1 then
			roomcollidecheck(room.x10y1)
		elseif py == 2 then
			roomcollidecheck(room.x10y2)
		elseif py == 3 then
			roomcollidecheck(room.x10y3)
		elseif py == 4 then
			roomcollidecheck(room.x10y4)
		elseif py == 5 then
			roomcollidecheck(room.x10y5)
		elseif py == 6 then
			roomcollidecheck(room.x10y6)
		elseif py == 7 then
			roomcollidecheck(room.x10y7)
		elseif py == 8 then
			roomcollidecheck(room.x10y8)
		elseif py == 9 then
			roomcollidecheck(room.x10y9)
		elseif py == 10 then
			roomcollidecheck(room.x10y10)
		end
	end
end
function love.update()
	love.window.setTitle("SID: Hero of Dellwood")
	playercollidecheck()
end
function love.keypressed(key)
	if key == "w" then
		py = py - 1
	elseif key == "s" then
		py = py + 1
	elseif key == "a" then
		px = px - 1
	elseif key == "d" then
		px = px + 1
	end
end
function drawRoom()
	drawTile(room.x1y1, 1, 1)
	drawTile(room.x1y2, 1, 2)
	drawTile(room.x1y3, 1, 3)
	drawTile(room.x1y4, 1, 4)
	drawTile(room.x1y5, 1, 5)
	drawTile(room.x1y6, 1, 6)
	drawTile(room.x1y7, 1, 7)
	drawTile(room.x1y8, 1, 8)
	drawTile(room.x1y9, 1, 9)
	drawTile(room.x1y10, 1, 10)
	drawTile(room.x2y1, 2, 1)
	drawTile(room.x2y2, 2, 2)
	drawTile(room.x2y3, 2, 3)
	drawTile(room.x2y4, 2, 4)
	drawTile(room.x2y5, 2, 5)
	drawTile(room.x2y6, 2, 6)
	drawTile(room.x2y7, 2, 7)
	drawTile(room.x2y8, 2, 8)
	drawTile(room.x2y9, 2, 9)
	drawTile(room.x2y10, 2, 10)
	drawTile(room.x3y1, 3, 1)
	drawTile(room.x3y2, 3, 2)
	drawTile(room.x3y3, 3, 3)
	drawTile(room.x3y4, 3, 4)
	drawTile(room.x3y5, 3, 5)
	drawTile(room.x3y6, 3, 6)
	drawTile(room.x3y7, 3, 7)
	drawTile(room.x3y8, 3, 8)
	drawTile(room.x3y9, 3, 9)
	drawTile(room.x3y10, 3, 10)
	drawTile(room.x4y1, 4, 1)
	drawTile(room.x4y2, 4, 2)
	drawTile(room.x4y3, 4, 3)
	drawTile(room.x4y4, 4, 4)
	drawTile(room.x4y5, 4, 5)
	drawTile(room.x4y6, 4, 6)
	drawTile(room.x4y7, 4, 7)
	drawTile(room.x4y8, 4, 8)
	drawTile(room.x4y9, 4, 9)
	drawTile(room.x4y10, 4, 10)
	drawTile(room.x5y1, 5, 1)
	drawTile(room.x5y2, 5, 2)
	drawTile(room.x5y3, 5, 3)
	drawTile(room.x5y4, 5, 4)
	drawTile(room.x5y5, 5, 5)
	drawTile(room.x5y6, 5, 6)
	drawTile(room.x5y7, 5, 7)
	drawTile(room.x5y8, 5, 8)
	drawTile(room.x5y9, 5, 9)
	drawTile(room.x5y10, 5, 10)
	drawTile(room.x6y1, 6, 1)
	drawTile(room.x6y2, 6, 2)
	drawTile(room.x6y3, 6, 3)
	drawTile(room.x6y4, 6, 4)
	drawTile(room.x6y5, 6, 5)
	drawTile(room.x6y6, 6, 6)
	drawTile(room.x6y7, 6, 7)
	drawTile(room.x6y8, 6, 8)
	drawTile(room.x6y9, 6, 9)
	drawTile(room.x6y10, 6, 10)
	drawTile(room.x7y1, 7, 1)
	drawTile(room.x7y2, 7, 2)
	drawTile(room.x7y3, 7, 3)
	drawTile(room.x7y4, 7, 4)
	drawTile(room.x7y5, 7, 5)
	drawTile(room.x7y6, 7, 6)
	drawTile(room.x7y7, 7, 7)
	drawTile(room.x7y8, 7, 8)
	drawTile(room.x7y9, 7, 9)
	drawTile(room.x7y10, 7, 10)
	drawTile(room.x8y1, 8, 1)
	drawTile(room.x8y2, 8, 2)
	drawTile(room.x8y3, 8, 3)
	drawTile(room.x8y4, 8, 4)
	drawTile(room.x8y5, 8, 5)
	drawTile(room.x8y6, 8, 6)
	drawTile(room.x8y7, 8, 7)
	drawTile(room.x8y8, 8, 8)
	drawTile(room.x8y9, 8, 9)
	drawTile(room.x8y10, 8, 10)
	drawTile(room.x9y1, 9, 1)
	drawTile(room.x9y2, 9, 2)
	drawTile(room.x9y3, 9, 3)
	drawTile(room.x9y4, 9, 4)
	drawTile(room.x9y5, 9, 5)
	drawTile(room.x9y6, 9, 6)
	drawTile(room.x9y7, 9, 7)
	drawTile(room.x9y8, 9, 8)
	drawTile(room.x9y9, 9, 9)
	drawTile(room.x9y10, 9, 10)
	drawTile(room.x10y1, 10, 1)
	drawTile(room.x10y2, 10, 2)
	drawTile(room.x10y3, 10, 3)
	drawTile(room.x10y4, 10, 4)
	drawTile(room.x10y5, 10, 5)
	drawTile(room.x10y6, 10, 6)
	drawTile(room.x10y7, 10, 7)
	drawTile(room.x10y8, 10, 8)
	drawTile(room.x10y9, 10, 9)
	drawTile(room.x10y10, 10, 10)
end
function drawTile(tilename, tilex, tiley)
	if tilename == "tree" then
		love.graphics.draw(tree, tilex, tiley)
	elseif tilename == "wall" then
		love.graphics.draw(wall, tilex, tiley)
	elseif tilename == "water" then
		drawWater(tilex, tiley)
	end
end
function drawWater(waterx, watery)
	if spriteanimcount < 5 and spriteanimcount >= 0 then
		love.graphics.draw(water1, waterx, watery)
		spriteanimcount = spriteanimcount + 1
	elseif spriteanimcount >= 5 and spriteanimcount <= 10 then
		love.graphics.draw(water2, waterx, watery)
		spriteanimcount = spriteanimcount + 1
	elseif spriteanimcount > 10 then
		spriteanimcount = 0
	end
end
function love.draw()
	love.graphics.clear()
	love.graphics.scale(64, 64)
	drawRoom()
	love.graphics.draw(playerimage, px, py)
end
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: My game won't draw the images, but reports no errors

Post by Davidobot »

I would recommend removing:

Code: Select all

love.graphics.clear()
love.graphics.scale(64, 64)
It's definitely the scale thing that's doing it though - if you want to increase the scale twice over, just do love.graphics.scale(2, 2)
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Positive07
Party member
Posts: 1015
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: My game won't draw the images, but reports no errors

Post by Positive07 »

Scale x64 means that one pixel in the image is rendered as 64 pixels in the screen. If your images are 32x32pxs then it will be drawn as 2048x2048pxs
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
SooBaccaCole
Prole
Posts: 2
Joined: Fri Dec 30, 2016 5:06 am

Re: My game won't draw the images, but reports no errors

Post by SooBaccaCole »

Thanks for letting me know! For some reason I thought it meant it was increasing the grid space for pixels, seeing as that would allow me to not have to put *64 at the end of every set of coordinates to get everything to use the same grid and still fit properly. I'm really glad this forum is here, otherwise I would have been stuck for ages! Thanks again!
User avatar
Positive07
Party member
Posts: 1015
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: My game won't draw the images, but reports no errors

Post by Positive07 »

You mean only scaling position? Well that is not possible if you do that, then you need to divide your image scale by 64.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: My game won't draw the images, but reports no errors

Post by Beelz »

I meant to just comment here and there and tweak a few things but it basically turned into a rewrite... Either way it gave me a much needed break from my current headache. Just keep in mind: I don't have your assests, nor did I use any to test this code... Nor did I test this code. I did write it up in an editor though, so it's already formatted for ease. I'll say now it may or may not work, but hopefully it will at least help you in some way.

Code: Select all

-- Not trying to go into a ton of detail, but here are a few optimizations to make learning easier for you. :)
-- Not saying any of the things I'm doing here are the best solutions... but it should help you to understand them.
-- First, it's good practice to keep things "local". Look into scope.


-- We'll start by moving your player into a table...
-- Pretty much everything in Lua is implemented with tables.
local player = {
	dir = "South",
	x = 2,
	y = 2,

	spriteanimcount = 0,
	image = love.graphics.newImage("SIDHODMunWPlayerNoClass.png")
}


-- Then we're putting these into a table, so you can make the "room" table below easier
local items = {
	tree = love.graphics.newImage("SIDHODTree.png"),	-- Since tree is first entry in table, items[1] = tree
	wall = love.graphics.newImage("SIDHODWall.png"),
	water1 = love.graphics.newImage("SIDHODWater1.png"),
	water2 = love.graphics.newImage("SIDHODWater2.png")
}

-- Also we just want a few constants to work with
local tileSize = 32
local numRows = 10 		-- y
local numColumns = 10 	-- x


-- Now we condense this table down so we can iterate over it...
-- Just note, when referenced it will be room[y][x], because x is a item inside each y table.
-- If you wanted to make more rooms you could just put this room into another table of rooms(see what I mean about tables?)
local room = {
	{1,1,1,1,1,1,1,1,1,1},	-- y = 1
	{1,0,0,0,0,0,0,0,0,1},	-- y = 2
	{1,0,2,2,2,2,0,0,0,1},	-- y = 3
	{1,0,2,0,0,2,0,0,0,1},	-- etc
	{1,0,2,2,2,2,0,0,0,1},
	{1,0,0,0,0,0,0,0,0,1},
	{1,0,0,0,0,0,0,0,0,1},
	{1,0,0,0,0,0,0,0,0,1},
	{1,0,0,0,0,0,0,0,0,1},
	{1,1,1,1,1,1,1,1,1,1}
}

-- With the use of tables, there's no need to hardcode 200 lines for collisions and drawing! :)

function love.update()
	-- You don't want to update the title every frame. Once at the top of the file, or in conf.lua, is sufficient.
	-- love.window.setTitle("SID: Hero of Dellwood")

	-- Seeing as your player movement code is in keypressed I'll assume that was intentional. That being the case, I moved
	-- the collision code there. Only moving the player once every keypress means you only need to see if it collides before you move.

	-- If you want to hold a key to a constant rate, you'd put your movement and collison code here.
end

function love.draw()
	-- Here's the best part about tables, iteration!
	for y = 1, numRows do
		for x = 1, numColumns do

			-- Because water is animated and has its own function, we'll seperate it
			if tilename == "water" then
				drawWater(x, y)
			else
				-- Then use the "room" table to draw each tile. Keep in mind we haven't touched on depth buffers or draw orders.
				-- Like this it draws left to right, top to bottom.
				love.graphics.draw(items[room[y][x]], (x-1)*tileSize, (y-1)*tileSize)
			end

		end
	end

	love.graphics.draw(player.img, (player.x-1)*tileSize, (player.y-1)*tileSize)
end

function love.keypressed(key)
	-- Create some local varibles to play with
	local tx, ty = player.x, player.y 

	if key == "w" then
		ty = ty - 1
		player.dir = "North"

	elseif key == "s" then
		ty = ty + 1
		player.dir = "South"

	elseif key == "a" then
		tx = tx - 1
		player.dir = "West"

	elseif key == "d" then
		tx = tx + 1
		player.dir = "East"
	end

	-- Check if you can move
	if room[ty][tx] == 0 then -- because 0 = "none"
		player.x, player.y = tx, ty
	end
end

function drawWater(waterx, watery)
	-- Because if statements skip all remaining elseif's and else's when one is found true, we can skip a few ands

	if spriteanimcount >= 10 then
		spriteanimcount = 0
	elseif spriteanimcount >= 5 then
		love.graphics.draw(items.water2, (waterx-1)*tileSize, (watery-1)*tileSize)
	else
		love.graphics.draw(items.water1, (waterx-1)*tileSize, (watery-1)*tileSize)
	end

    spriteanimcount = spriteanimcount + 1
end
The use of tables have reduced your file from 503 lines to just 119(with all the comments :cool: )!

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
trelemar
Prole
Posts: 22
Joined: Fri Dec 16, 2016 12:21 pm

Re: My game won't draw the images, but reports no errors

Post by trelemar »

You should teach yourself how to use for loops and tables. 90% of your code could be removed with the same effect.

Instead of:

Code: Select all

function love.draw()
  drawTile(room.x1y1, 1, 1)
  drawTile(room.x1y2, 1, 2)
  drawTile(room.x1y3, 1, 3)
  --ect...
end
You would do:

Code: Select all

function love.draw()
  for i = 1,50 do
    drawTile(room.x1y..i, 1, i)
  end
end
And that above code would draw 50 sprites with 3 lines of code.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests