Mar 14, 2012 at 8:49 PM
Edited Mar 14, 2012 at 9:27 PM
I'm currently working on a platform game in the kind of Terraria and I have a problem.
Here is a screenshot from the game :
You can we have several blocks put close to each others. The problem is that when you walk on the right or on the left, you sometimes (often actually) get stuck by one of those blocks without any reason...
The blocks are spawned by two for loops :
I have only removed some custom function that doesn't read or modify the position of the body.
// the const BLOCK_OFFSET doesn't change anything to the bug
float size = GRID_SIZE - BLOCK_OFFSET;
Body _baseBody = BodyFactory.CreateRectangle(World, size, size, 6f, BlockTypes.Ground);
for (float y = 0; y < 21; y += GRID_SIZE)
for (float x = -40; x < 41; x += GRID_SIZE)
Body _terrain = _baseBody.DeepClone();
_terrain.Position = new Vector2(x, y);
I don't know if it's from my code or from the engine...
Edit : the picture wasn't uploading :(