Tag Info

New answers tagged

1

Using a 2D tile array for your world/level generation and representation will definitely simplify things. For example you could internally represent your world in a grid of tiles and take it from there : using System; using System.Collections.Generic; using System.Text; namespace Tiles { public class Vector2 { public int x; public int y; ...


2

If you're using a grid, you shouldn't be using Unity's physics for collision detection - use the grid. Get your position on the grid then do something like this: public bool GridCast (Coordinate Position, Coordinate Direction, int Length) { for (int i = 0; i < Length; i++) { Coordinate Check = Position + Direction * Length; if ...


0

http://www.arongranberg.com/astar/docs/modifiers.php#simplesmooth If you're using Aron Granberg's pathfinder, then are you perhaps using one of the smoothing modifiers? This would result in the unit trying to optimize the path which would probably prevent the unit from hitting each node as it steps through the path. Or is the problem that you have a ...


1

A naive algorithm to find one pattern in a grid would be this: for (int grid_x = 0; grid_x < grid_width; grid_x++) { for (int grid_y = 0; grid_y < grid_height; grid_y++) { bool fail = false; for (pattern_x = 0; pattern_x < pattern_width && fail == false; pattern_x++) { for (pattern_y = 0; pattern_y < ...



Top 50 recent answers are included