Jump to content

Rotation using starstruck example


lucky de
 Share

Recommended Posts

Hey guys,
Just started using phaser today, loving the integration with tiled and it's been a of fun messing with the code :)
However with the platformer example its a bit too perfect, I cant manipulate individual tiles. Reason why I want to do this is to figure out how to rotate the player character when he's on a slanted tile. Currently when  you're on one you kind of freeze and nudge forward, it's not really that fluid. Any suggestions on this? 

Thanks!

Link to comment
Share on other sites

sorry, I don't really understand your question. perhaps others are having the same difficulty.

 

what exactly are you trying to accomplish? if you could elucidate a bit perhaps someone may be able to help.

Link to comment
Share on other sites

Oh Sure thing, you know how on the example platformer there are curved tiles 45 degrees
52d721cf272dd.png
Currently if you use it the character would kind of just stick there and it just doesn't seem fluid. I thought if there was a way so that when the character sprite hits that specific tile on the sprite sheet it rotates 45% and on leaving it goes back to 0, that would make it seem more fluid/ OR if the character wouldnt stick like it does now that'd be fantastic. 
Is that clearer? :)

Link to comment
Share on other sites

yes, much clearer, thanks.

 

to support sloped tiles you'll need to override the tile separation mechanics in ArcadePhysics.js. (in other words, Phaser doesn't currently support sloped tiles). if you search the forum you'll find several discussions about sloped tiles. (keep in mind though that Phaser 1.1.4 is due out "any day now" and the tilemap system is completely re-written, so some of what you read may not apply).

 

FWIW 45 degree slopes are pretty simple to implement for basic collision/separation, as the x and y values are related 1:1 (e.g. as x goes up/down 1 pixel so does y). other angles (22.5 etc) are equally simple, but arbitrary angles are more complicated (and thus slower to compute). search the web for articles on "separating axis theorem" ("SAT") collision detection for more information.

 

getting all the physics interactions (bounce, gravity) to work properly with the sloped tiles is also considerably more work. I implemented 45 degree slopes in 1.1.3 without too much trouble, but never bothered to get the bounce and gravity right.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...