Jump to content

Player movement


piterio
 Share

Recommended Posts

Hi, 

 

I'm new and my English isn't very good... I hope you will understand what I'm trying to do.

 

I'm doing a html5 game like Metal Slug, or something like that, and I want a specific behaviour which I found in http://test.xapient.net/phaser/attm/. I know this game was made by a member of this forum (@valueerror) so I hope he can help me.

 

The behaviour I want is the one made by Mario who is able to walk to the middle of the screen and then he stop moving forward and now is the "world" who is moving. 

 

Sorry about my English and thank you very much!!! 

Link to comment
Share on other sites

 

This feature is not making the world move, but the camera. It's included in a lot of Phaser examples. Here's the basic examples search: http://phaser.io/examples/v2/search?search=follow. The way you can achieve the following is this:

game.camera.follow(player);//Substitute player with your own player sprite

 

 

I'm using that. I have: 

game.camera.follow(player);

where

player = game.add.sprite(playerX, playerY, spritePlayer);

but it doesn't work and I don't know why because I think I'm doing it right  :(

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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