BenClarkson

Ninja physics confusion

Recommended Posts

Hi, I'm developing a quick framework to let at risk inner city youth design video game levels for a workshop I am leading next week. I have been playing around with phaser for about a month and I've got a decent handle of P2 and Arcade, but as I looked closer to what I'd need to be able to do to let the kids just draw levels on paper and then transfer that into a framework I've settled on Ninja because it allows for bounds, one way platforms and the overlay callback which lets them include some pretty standard platformer mechanics that I predict they'll want to include.

So I am just having a little bit of trouble getting the slopemap to work with a tilemap. I am using the default ninja tilemap and then I am planning to import the art the kids draw overtop of the tiles so it looks like their characters are walking on the actual sprites. 

I am having a hell of a time actually getting this to work. Any help would be appreciated. The limited examples for Ninja physics is really draining. I really want to have a working prototype by the time I present the workshop. I'm going to be asking a lot of questions this week because I really want to present something fun for the kids to fuel their interest in computers (which are awesome)

Cheers

Share this post


Link to post
Share on other sites

You're the best Rich. 

I have some questions. I bashed my head against my desk.

I got my tileset to work. If I want different classes of tiles (one way platforms) I will have to place those on another layer with different properties correct?
Right now to evaluate collisions with the tileset I am basically looping through all the tiles like in the tileset example and checking AABBVSTileset collisions. Will I have to do this independently for every layer? This seems very expensive. Is there a way to optimize that with groups?
Ladders and spikes would also be on different layers? For these I would be doing an overlay check right?

And for placing the art on top of the tileset I'd just put a sprite on the top of the draw group? Is there a more efficient way of managing large art maps like the kids will draw (ie breaking them up as a group?)

Thanks a lot. I am really excited to show everyone what the kids end up making.

Share this post


Link to post
Share on other sites

I would use Sprites for all non-standard tiles (one-way platforms, ladders) as they'll need custom handling.

 

You can check Sprite vs. Tileset collision with a single call:

game.physics.ninja.collide(sprite1, tiles);

.. which will do the rest for you. But there's no support for Group vs. Tileset at the moment in Ninja (lots of the similar Arcade Physics commands are missing from there too - please be wary of this).

 

Adding art on-top - for the tiles I would take one of the PNGs from resources\Ninja Physics Debug Tiles and just draw over the top :) then import that into Tiled and edit your level to your hearts content. Got to be easier than placing down a Sprite over the top of every tile.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.