Krautman Posted September 29, 2017 Share Posted September 29, 2017 Hey Guys, 1st try with phaser, so maybe I'm missing a really basic point. I've looked into the API and examples of tweens but I'm slowly getting mad over here. I'm trying to make my player move in an isometric world. I want him to move grid by grid and not smoothly as long as a curser is held down. E.g. user pressed "Right" player moves "one unit" to the right. not more or less. "one unit" is a constant and has currently the value of 20. I'm using this iso-plugin (http://rotates.org/phaser/iso/). My current approach is to call a function on space.onDown with the following line: game.add.tween(player).to({ isoX: '+20' }, 100, Phaser.Easing.Linear.None, true); well, what happens now is that the player is moved from starting point isoX = 128 to isoX = 368,4 (wtf!) I would expect it to move to isoX = 148. if I press a second time spacebar the player is correctly moved to 388,4. A third time is also working fine and so on. I just don't know why the first time the player is moved to a kind of worldbounds or something...really strange You can try for yourself and see the whole code at: http://www.jungbrunnen.koeln/sandbox/phaser/isometric/boxes.html PS: maybe my approach is all bogus. Is there a better way of doing this? thanks for any help and advice! Link to comment Share on other sites More sharing options...
samid737 Posted September 30, 2017 Share Posted September 30, 2017 Maybe incrementing isoX works: space.onDown.add(function () { player.isoX+=20; }, this); Link to comment Share on other sites More sharing options...
samme Posted September 30, 2017 Share Posted September 30, 2017 Switch to the latest Phaser and see if the problem is still there. Link to comment Share on other sites More sharing options...
Krautman Posted October 2, 2017 Author Share Posted October 2, 2017 thx for your answers! @samid737 it works but doesn't solve my problem...later on I would like to animate the movement of the player. I thought using a tween for moving and a second for animation would be the right approach. Just changing the position is pretty ugly...do you have any idea where to look for bugs? @samme I've updated to v2.8.8 - same output :/ any ideas? Link to comment Share on other sites More sharing options...
samid737 Posted October 2, 2017 Share Posted October 2, 2017 try: game.add.tween(player).to({ isoX: player.isoX+20 }, 100, Phaser.Easing.Linear.None, true); Otherwise, you can try to search for related issues via github. Link to comment Share on other sites More sharing options...
Krautman Posted October 2, 2017 Author Share Posted October 2, 2017 @samid737 thx but no effect. The strange thing is: pressing space the first time is messed up, but the following times it seems to work fine. it moves the sprite correctly. Maybe this is a iso-plugin issue? I'll check on github... ll Link to comment Share on other sites More sharing options...
Krautman Posted October 2, 2017 Author Share Posted October 2, 2017 EDIT: I didn't find anything related on github but I changed my player-obj to a simple sprite instead of the IsoSprite from the plugin and it worked on flat 2D as expected. Therefore I believe it's an issue of the isometric plugin. Well this won't make the bugfixing easier since it's no longer supported...but it's a starting point I guess... Link to comment Share on other sites More sharing options...
Krautman Posted October 2, 2017 Author Share Posted October 2, 2017 After looking 5 min into the plugin js I've noticed a comment describing a similiar issue. The solution is to add: player.body.moves = false; et voila - it moves nicely on the isoX-Axis. SOLVED samid737 1 Link to comment Share on other sites More sharing options...
Recommended Posts