Jump to content

N00B question


dthrasher90
 Share

Recommended Posts

Aloha!

What first comes to mind:

myObject.y = 50;

But, really, there's many answers to this question. Perhaps you want 50px from the original spot rather than "50 px along the y axis", in that case you might prefer:

myObject.y += 50;

// or

myObject.y -= 50;

Or, maybe you have something else in mind. I think this link will be helpful:

https://phaser.io/examples/v2/sprites/move-a-sprite

Link to comment
Share on other sites

So Im trying to create a football game. I m just trying to see if I can get the guys moving on the field.  my goal is to try to get all this code reusable so i dont have to copy/paste eveything for every person.  I just started playing around with this today. The object is you cilck on a play and the computer moves the pieces, base on your players abilities, more rpg, less playstation.

 

    function create () {
            game.physics.startSystem(Phaser.Physics.ARCADE);
            var field = game.add.sprite(game.world.centerX, game.world.centerY, 'field');
            field.scale.setTo(2.75);
            field.anchor.setTo(0.5);

            var wr1 = game.add.sprite(100,200, 'wr1');
             wr1.scale.setTo(0.5);

            //  wr1.animations.add('run');
            //  wr1.animations.play('run', 10, true);
             game.physics.arcade.enable(wr1);

             var wr2 = game.add.sprite(100, 250, 'wr2');
              wr2.scale.setTo(0.5);
              // wr2.animations.add('run',  10, true);
              //
              // game.physics.arcade.enable(wr2);
              // wr2.animations.add('run');
              // wr2.animations.play('run', 150,  true);
              // game.physics.arcade.moveToXY(wr2, 10,50);


        }

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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