New answers tagged

0

One way to implement this is to use clearance, and have all of the tiles around obstacles contain numbers represent their proximity to the object for example a map that looked like this: map = { {0,0,0,0} {0,1,1,0}, {0,1,1,0}, {0,0,0,0}, } would look like this: map = { {1,1,1,1} {1,2,2,1}, {1,2,2,1}, {1,1,1,1}, }


0

Store inside each entity not only its position, but also its size. Then you can reconstruct the collision map from your entity list, something like this: -- [ Assign 0 to everything in the map. ] -- Then block out a 1 for each square within the entity's size for _, entity in entities do local pos = entity.position for xIncrement=0,entity.size.x do ...


2

When i is 0 you copy the row 0 into the row 1, then i is 1 and you copy the row 1 into the row 2, etc. The problem is that when you copy the row 1, it has already been overriden. You probably also have a problem when i = HEIGHT because i+1 is out of bounds. The solution would be to iterate from the bottom row to the top row (from HEIGHT-1 to 1): for (i = ...


3

first time here, have some time to kill so this is what I did. I'm assuming this is in a gui/2d game. This is what i did to get it to work. create a canvas and add 4 UI images. These act as the 4 points(vector3's) create a script and setup a way to draw lines so that you know that you are getting the right positions now you can move the images to make ...



Top 50 recent answers are included