Raagh Posted December 26, 2017 Share Posted December 26, 2017 Hey guys, so probably I am doing tons of things wrong, but i cant get to move my characters( with the physics enabled) . if i change the position for the sprite of course it works. but doing it by velocity it doesnt. Those someone mind checking my code? Particularly the play state in src/states/play.js and the player sprite in src/sprites/player.js https://github.com/Raagh/a-game-needs-no-name to run the game do npm install npm run web Thanks. I will post here if i do some progress. Link to comment Share on other sites More sharing options...
Madclaws Posted December 27, 2017 Share Posted December 27, 2017 did u check "player.body.velocity.x" Link to comment Share on other sites More sharing options...
Raagh Posted December 27, 2017 Author Share Posted December 27, 2017 1 hour ago, Madclaws said: did u check "player.body.velocity.x" ýeah i tried velocity and it didnt work. neither poisition( pretty sure its because I am working with the player class not actually with the sprite that game.add.sprite() returns) but I am confused on how this should be done using es6 Link to comment Share on other sites More sharing options...
Madclaws Posted December 27, 2017 Share Posted December 27, 2017 why are you extending player class with phaser.Sprite.You Can add a _playersprite variable (of Phaser.Sprite type) in Player class (as a property) and return the Player object.Then access the _playerSprite property in play state. Link to comment Share on other sites More sharing options...
Recommended Posts