seanBlythe Posted July 2, 2014 Share Posted July 2, 2014 I really wanted to work this out myself before making this topic but I'm having no luck. So how do I get my enemy sprites to move left and right along a 2D platform? and where in the examples in this explained? Also, can someone explain what tween is or does? Link to comment Share on other sites More sharing options...
beuleal Posted July 2, 2014 Share Posted July 2, 2014 Did u create an enemy object? like tank exemple: http://examples.phaser.io/_site/view_full.html?d=games&f=tanks.js&t=tanks if u did, u need to create a method called moveRight() and moveLeft().In the end of object u call one of the functions above. I dont know if im right, but i would make it. Link to comment Share on other sites More sharing options...
seanBlythe Posted July 2, 2014 Author Share Posted July 2, 2014 Yes I've create my enemy sprite. is this the line that moves the enemy tanks: game.physics.arcade.velocityFromRotation(this.tank.rotation, 100, this.tank.body.velocity); I'm confused Link to comment Share on other sites More sharing options...
beuleal Posted July 2, 2014 Share Posted July 2, 2014 enemy sprite is different of enemy object.. im saying to do something like this:EnemyTank = function () {sprites...atributes...etc}EnemyTank.prototype.moveRight(){}EnemyTank.prototype.moveLeft(){}to move your enemythis.tank.body.acceleration.x = 200 //moveRightthis.tank.body.acceleration.y = -200 //moveLeft Link to comment Share on other sites More sharing options...
Recommended Posts