ARGH! The tiles are distorted.

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
S-Rave
Prole
Posts: 39
Joined: Wed Feb 25, 2009 4:41 pm

ARGH! The tiles are distorted.

Post by S-Rave »

Lame name for a lame game.

Just because it was so simple and fast to make...
Also, there's some initiation problems :\ or something. This doesn't work:

Code: Select all

map = {
	   img = love.graphics.newImage("gfx/image.png"),
	   tilesx = 5,
	   tilesy = 5,
	}
 	for y = 1, map.tilesy do
 	    for x = 1, map.tilesx do
	    	map[y][x] = (x-1) + (y-1) * map.tilesy
		end
	end
But this does:

Code: Select all

map = {
	   img = love.graphics.newImage("gfx/image.png"),
	   tilesx = 5,
	   tilesy = 5,

	   {0,1,2,3,4},
	   {5,6,7,8,9},
       {10,11,12,13,14},
       {15,16,17,18,19},
       {20,21,22,23,24},
	}
 	for y = 1, map.tilesy do
 	    for x = 1, map.tilesx do
	    	map[y][x] = (x-1) + (y-1) * map.tilesy
		end
	end
Why? :S
Attachments
ARGHThetilesaredistorted.love
(5.49 KiB) Downloaded 153 times
srejv
User avatar
whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

Re: ARGH! The tiles are distorted.

Post by whitebear »

Because your function needs all arguments. They can't use null for any calculation.
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: ARGH! The tiles are distorted.

Post by qubodup »

I'm not sure, but perhaps you have to create map[y] before you can create map[y][x]?
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: ARGH! The tiles are distorted.

Post by rude »

qubodup wrote:I'm not sure, but perhaps you have to create map[y] before you can create map[y][x]?
That's probably it.

Code: Select all

map = {
      img = love.graphics.newImage("gfx/image.png"),
      tilesx = 5,
      tilesy = 5,
   }
   for y = 1, map.tilesy do
       map[y] = {}
       for x = 1, map.tilesx do
          map[y][x] = (x-1) + (y-1) * map.tilesy
      end
   end
User avatar
S-Rave
Prole
Posts: 39
Joined: Wed Feb 25, 2009 4:41 pm

Re: ARGH! The tiles are distorted.

Post by S-Rave »

Yes, I was thinking along those lines reading the first post. Gonna try it out when I get home. :)
Thanks! :D
srejv
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: ARGH! The tiles are distorted.

Post by bartbes »

I was about to say the same.. well anyway the game:
I'm not very good at those, so I didn't finish it. But it might be nice if you wrote the correct orientation somewhere, as it might be

Code: Select all

1 2
3 4
5 6
or

Code: Select all

1 4
2 5
3 6
(both just examples)
User avatar
S-Rave
Prole
Posts: 39
Joined: Wed Feb 25, 2009 4:41 pm

Re: ARGH! The tiles are distorted.

Post by S-Rave »

Yes, I would have implemented a menu but I'm too lazy. Gonna fix it up when I get home. Just press r to randomize.

*Gonna fix it so that you only have to press r to randomize.
srejv
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 190 guests