phaser/examples/input/drag.js
2013-10-22 03:58:20 +01:00

24 lines
615 B
JavaScript

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
function preload() {
game.load.image('grid', 'assets/tests/debug-grid-1920x1920.png');
game.load.image('atari', 'assets/sprites/atari800xl.png');
}
function create() {
game.add.sprite(0, 0, 'grid');
atari1 = game.add.sprite(300, 300, 'atari');
// Input Enable the sprites
atari1.inputEnabled = true;
// Allow dragging
// enableDrag parameters = (lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite)
atari1.input.enableDrag(true);
}