Tilemap collision

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Anxiety
Prole
Posts: 49
Joined: Sat Apr 02, 2011 9:36 am
Location: Finland

Tilemap collision

Post by Anxiety »

You know how you make a tilemap by taking a part of a picture and placing it on a quad and drawing it? Pff, thats easy. Now theres only one problem. How can i detect a collision with a certain tile? Im using a character which can move (obviously). I havent made the tilemap yet.
I can't come up with a good signature!
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Tilemap collision

Post by Lafolie »

This is pretty simple to do with Object Orientation. I would explain it but I'm not sure it would be beneficial. I think you should create something more simple than a tile-engine. Not that I'm discouraging you. I just think that, based on your other posts, you aren't ready for this yet.

But, that's just my humble opinion. Credits to you for trying and going ahead with this, but I reckon it would be a good move for you to try creating something simple and returning to this once you have a better grasp of Lua/Löve. :)

Oh, and this page may be of interest to you regarding tilemaps: http://info.sonicretro.org/SPG:Solid_Tiles
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
Anxiety
Prole
Posts: 49
Joined: Sat Apr 02, 2011 9:36 am
Location: Finland

Re: Tilemap collision

Post by Anxiety »

Well, what would be the more simple way, rather that tilemap?

And im learning all the time :)
I can't come up with a good signature!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Tilemap collision

Post by bartbes »

A tilesheet + quads is typically a good solution, personally, I'd put the static part of the map in a spritebatch, so you can draw that in one go.
User avatar
Anxiety
Prole
Posts: 49
Joined: Sat Apr 02, 2011 9:36 am
Location: Finland

Re: Tilemap collision

Post by Anxiety »

bartbes wrote:A tilesheet + quads is typically a good solution, personally, I'd put the static part of the map in a spritebatch, so you can draw that in one go.
Thats, basically what im trying to do. I just want to do it BIG size (http://love2d.org/forums/viewtopic.php?f=3&t=2857)
I can't come up with a good signature!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Tilemap collision

Post by bartbes »

So what's the problem?
User avatar
Anxiety
Prole
Posts: 49
Joined: Sat Apr 02, 2011 9:36 am
Location: Finland

Re: Tilemap collision

Post by Anxiety »

As i said, i want to make it big. Right now im using a table fileld with numbers, since thats the only thing i can do.
I can't come up with a good signature!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Tilemap collision

Post by Robin »

I still don't understand the problem?

EDIT: this sort of reads like: "I want to do X." "Then why don't you do X?" "No no, you don't understand. I want to do X."
Help us help you: attach a .love.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Tilemap collision

Post by tentus »

It sounds like he wants to make one big render of a level map, assign that as a tilemap, and then draw it out like a normal tilemap-based game.

If that's the case, :death: :death: :death:
Kurosuke needs beta testers
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Tilemap collision

Post by kikito »

Anxiety, repeating "I want to make it big" is not an explanation, it's a ... repetition. Tell us why "making it big" is an issue for you with more detail. Help us help you.

I'm going to make some hypothesis and give you some answers. I could go into more detail once I know what your problem is, exactly.
  • You are complaining that you have to type lots of tiles manually (100x100 tiles by hand can be lots of commas, apostrophes, etc). On that case, using a multi-line string instead of an array helps. See my tile tutorial
  • You don't know how to do scroll. In that case, the easiest thing to do is drawing everything on each frame and just translate with love.graphics.translate
  • You are complaining that drawing a big map is too slow. The simplest approach here is dividing the map into smaller maps - instead of 1 big map of 100x100, you have several smaller maps of 10x10. You only draw the maps that are visible. This can be made even faster if you use one Framebuffer per sub-map.
When I write def I mean function.
Post Reply

Who is online

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