Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Search the Community

Showing results for tags 'goomba'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. mrdotb

    goomba move

    Hi everyone, I want to move my enemy like this For the moment i use: function create_enemy() { APP.enemy = game.add.group(); tabEnemy = []; tabEnemy[0] = APP.enemy.create(2477, 1938, 'enemy'); tabEnemy[1] = APP.enemy.create(2813, 1842, 'enemy'); tabEnemy[2] = APP.enemy.create(3019, 1746, 'enemy'); tabEnemy[3] = APP.enemy.create(3551, 1650, 'enemy'); for (var i = 0; i < tabEnemy.length; i++) { game.physics.enable(tabEnemy[i]); }};function update_enemy() { game.physics.arcade.collide(APP.layer, APP.enemy); //enemy1 if (bow(tabEnemy[0].position.x) == bow(2477)) { tabEnemy[0].body.velocity.x = -100; }; if (bow(tabEnemy[0].position.x) == bow(1968)) { tabEnemy[0].body.velocity.x = 100; }; //enemy2 if (bow(tabEnemy[1].position.x) == bow(2813)) { tabEnemy[1].body.velocity.x = -100; }; if (bow(tabEnemy[1].position.x) == bow(2694)) { tabEnemy[1].body.velocity.x = 100; }; //enemy3 if(bow(tabEnemy[2].position.x) == bow(3200)) { tabEnemy[2].body.velocity.x = -100; }; if(bow(tabEnemy[2].position.x) == bow(3019)) { tabEnemy[2].body.velocity.x = 100; }; //enemy4 if(bow(tabEnemy[3].position.x) == bow(3551)) { tabEnemy[3].body.velocity.x = 100; }; if(bow(tabEnemy[3].position.x) == bow(3773)) { tabEnemy[3].body.velocity.x = -100; };};function bow(value){ var calcul = Math.ceil(value / 10) *10; return calcul;}Do you have a better way to do it ? Thank you.
×
×
  • Create New...