Home > Enterprise >  Phaser 3: Make object movement on the slope
Phaser 3: Make object movement on the slope

Time:05-23

I am trying following with this post:

https://cedarcantab.wixsite.com/website-1/post/phaser-coding-tips1-2-revisited-part-1-creating-a-game-like-tanks---worms

and now I want to make the tank move on the land especially move on the slope. Does anyone have any ideas? Thank you.

CodePudding user response:

As I remenmber for your earlier question, I assume you are using arcade physics, with that in mind, the answer is, it is "impossible" to move on slopes, except you want to do excessive calculation or so.

The best option is, if you switch to matter physics engine (matter.js). There this would work easy, and without special calculation and/or hacks. Just check out this exmaple for the official website https://phaser.io/examples/v3/view/physics/matterjs/add-body-to-text.

There is one Caveat: the matter engine works and is configured abit different than the arcade engine, so you would have to update most of your physics code.

  • Related