oh kk thx, but would u by chance know how to go about distributing each of these nape squares to my FP grid?
FlashPunk grid and Nape?
You could iterate through your grid and add a square body the size of a tile if that position is solid.
for(var i:int = 0; i < grid.height; i+32)
{
for (var j:int = 0; j < grid.width; j+32)
{
if (grid.getTile(i, j) == true)
{
//Nape body
var border:Body = new Body(BodyType.STATIC);
border.shapes.add(new Polygon(Polygon.rect(i, j, 32, 32)));
border.space = theGameWorld.space;
}
}
}
This dosent work:(
You have i
and j
mixed up. (@ border.shapes.add(new Polygon(Polygon.rect(i, j, 32, 32)));
)
nevermind, I kind of have it working using this
override public function update():void
{
border.position.x = x - FP.camera.x
border.position.y = y - FP.camera.y
}
altough other bodies wont collide with it for some reason:(
it just go through them, then when it reaches the end of the screen the programm crashes.
That’s strange. Are you sure the bodies are in the correct position? It doesn’t look like it from the screenshot
yea but u know man im kind of giving up lol. this is not my level i guess. ill post my source code if your interested.
I had so much trouble using Nape with FP that I temporarily changed to Flixel, so I feel you
Does the game need to be tile based? If it doesnt you could just use resizable entities in ogmo and create a body depending on the width and height of the arbitrarily sized entity. it beats having hundreds of bodies for the ground and walls.
Hmmmm I dont see any reason why the bodies should be tile based? Nape handles all collisions by default, there is really no reason to be using a flashpunk grid.
Yea I understood that. To get a scrolling world, I should be only moving the camera/how I
render the world, not moving the entire world around my camera. Its kinda funny looking back lol