Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var game = new Phaser.Game(400, 490, Phaser.AUTO, 'game_div');
- var main_state = {
- preload: function() {
- this.game.load.image('test', 'bird.png');
- },
- create: function() {
- this.game.physics.startSystem(Phaser.Physics.ARCADE);
- this.bird = this.game.add.sprite(100, 245, 'test');
- this.game.physics.enable(this.bird, Phaser.Physics.ARCADE);
- this.game.input.onDown.addOnce(this.move_it, this);
- },
- move_it: function() {
- //this.bird.body.x = 105; // this line works on 2.0 not in 2.0.1
- this.bird.x = 105; // this lines moves it in 2.0.1 but doesn't stop in 105, keeps velocity
- }
- };
- // Add and start the 'main' state to start the game
- game.state.add('main', main_state);
- game.state.start('main');
Advertisement
Add Comment
Please, Sign In to add comment