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

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...
 Share

  • Recently Browsing   0 members

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