love2D tileset problem

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
elsalvador
Citizen
Posts: 54
Joined: Thu Oct 24, 2013 1:29 am

love2D tileset problem

Post by elsalvador »

I copy the exact code from here:

Code: Select all

https://love2d.org/wiki/Tutorial:Efficient_Tile-based_Scrolling
I want to learn about tileset but when i zip it and turn it in to love:
that came.. was it me or the page its not right??? it didn'y show the example right..
any help plz!
Attachments
tileset.love
(116.63 KiB) Downloaded 136 times
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: love2D tileset problem

Post by s-ol »

elsalvador wrote:I copy the exact code from here:

Code: Select all

https://love2d.org/wiki/Tutorial:Efficient_Tile-based_Scrolling
I want to learn about tileset but when i zip it and turn it in to love:
that came.. was it me or the page its not right??? it didn'y show the example right..
any help plz!
what exactly is the problem? I see a map composed of tiles, which is basically what the tutorial is for, no?

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
elsalvador
Citizen
Posts: 54
Joined: Thu Oct 24, 2013 1:29 am

Re: love2D tileset problem

Post by elsalvador »

wait so the tutorial its just the tiles only what about the trees? etc ????? what which ones are those??? im confuse???
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Re: love2D tileset problem

Post by veethree »

elsalvador wrote:wait so the tutorial its just the tiles only what about the trees? etc ????? what which ones are those??? im confuse???
Perhaps if you read the tutorial you would be less confused. The tutorial is about how to set up a tile map with a spritebatch. The tileset with the trees is just an example. It's not the one used in the tutorial.
User avatar
Garmelon
Prole
Posts: 19
Joined: Tue Jun 02, 2015 5:25 pm

Re: love2D tileset problem

Post by Garmelon »

It actually is the one used in the tutorial, but the trees aren't used for the map.
If you wanted to use a tree as a tile, you could change this line:

Code: Select all

tileQuads[0] = love.graphics.newQuad(0 * tileSize, 20 * tileSize, tileSize, tileSize, tilesetImage:getWidth(), tilesetImage:getHeight())
to this:

Code: Select all

tileQuads[0] = love.graphics.newQuad(2 * tileSize, 20 * tileSize, tileSize, tileSize, tilesetImage:getWidth(), tilesetImage:getHeight())
What that does is it picks the tree as tileQuad instead of the grass because we "move along" 2*tileSize on the x axis.
elsalvador
Citizen
Posts: 54
Joined: Thu Oct 24, 2013 1:29 am

Re: love2D tileset problem[UNSOLVED]

Post by elsalvador »

Thank you I get that part now..
but what I don't get is why this tutorial its difficult?
I wrote the first part of the tutorial and no tile works and they are in random orders?
even the complete work still random order? nothing like the picture on the top right corner at all!
am I reading the tutorial wrong? or the tutorial its for experts only?????
Attachments
tileset.love
(116.11 KiB) Downloaded 110 times
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Re: love2D tileset problem[UNSOLVED]

Post by veethree »

elsalvador wrote:Thank you I get that part now..
but what I don't get is why this tutorial its difficult?
I wrote the first part of the tutorial and no tile works and they are in random orders?
even the complete work still random order? nothing like the picture on the top right corner at all!
am I reading the tutorial wrong? or the tutorial its for experts only?????
"Screenshot of tile-based scrolling with a simple map generator.". That's the text under that image. The actual tutorial doesn't cover the simple map generator. I believe the person who wrote it figured that was outside of the scope of the tutorial as it's focus is to show you how to use a spritebatch.

Here's the code that generates the map in the tutorial:

Code: Select all

function setupMap()
  mapWidth = 60
  mapHeight = 40
 
  map = {}
  for x=1,mapWidth do
    map[x] = {}
    for y=1,mapHeight do
      map[x][y] = love.math.random(0,3)
    end
  end
end
This function creates a 2d array, where each entry is a random number between 0 and 3. Each number represents a tile. This is why all the tiles are in random order.
elsalvador
Citizen
Posts: 54
Joined: Thu Oct 24, 2013 1:29 am

Re: love2D tileset problem

Post by elsalvador »

Thank You so much and { OHHhh..}
perhaps what I seek can achieve it with anim8 right???
and as for that tutorial on the wiki its not 100% useful for super-beginners..
Post Reply

Who is online

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