I need tutorials on Map making and collision

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
Dev_Bacon
Prole
Posts: 1
Joined: Mon Feb 04, 2013 9:39 pm

I need tutorials on Map making and collision

Post by Dev_Bacon »

Can anyone teach me something about map making? I've made a game where theres only a floor, but I don't know how to add walls or anything thats not the floor. I've seen codes where it has a bunch of numbers, something like this

10000000000000000001
11111100000000111111
10000000000000000001
11111111111111111111

I think it works like this. All the 0s are nothing or air, and all the 1s are platforms.
Is there any imformation on this code?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: I need tutorials on Map making and collision

Post by kikito »

When I write def I mean function.
Refsa
Prole
Posts: 1
Joined: Thu Feb 07, 2013 9:13 pm

Re: I need tutorials on Map making and collision

Post by Refsa »

With your tile tutorial Kikito. How would you proceed with making a functional block detection system. I can't seem to figure out how to look up the correct character from quadInfo and use it in my collision function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: I need tutorials on Map making and collision

Post by kikito »

Assuming that your characters are smaller than the cells in your game, that they start in a "normal" (not wall) cell, and that they don't move fast enough to "completely cross" a cell in a single update, the simplest way to do collision with a map is this one:

1. Determine on which cell your character is (the cell where the central point of his "feet" are).
2. If your character is moving up,
3. And the cell "up" from the current cell is "non-walkable"
4. Move the character "back down" until he's not touching the cell "up" any more.
5. Repeat steps 2,3,4 for "left", "down" and "right".
Refsa wrote:I can't seem to figure out how to look up the correct character from quadInfo and use it in my collision function.
You need to look in tileTable, not in quadInfo.
When I write def I mean function.
Post Reply

Who is online

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