mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Tidying up a bit
This commit is contained in:
@@ -6,26 +6,32 @@ function preload() {
|
||||
}
|
||||
|
||||
var pic;
|
||||
var cropRect;
|
||||
|
||||
function create() {
|
||||
|
||||
pic = game.add.sprite(0, 0, 'trsi');
|
||||
|
||||
|
||||
pic.cropEnabled = true;
|
||||
|
||||
pic.crop.width = 128;
|
||||
pic.crop.height = 128;
|
||||
|
||||
cropRect = {x : 0, y : 0 , width : 128, height : 128};
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
pic.x = game.input.x;
|
||||
pic.y = game.input.y;
|
||||
if(game.input.x < pic.width && game.input.y < pic.height){
|
||||
|
||||
pic.crop.x = game.input.x;
|
||||
pic.crop.y = game.input.y;
|
||||
pic.x = game.input.x;
|
||||
pic.y = game.input.y;
|
||||
|
||||
cropRect.x = game.input.x;
|
||||
cropRect.y = game.input.y;
|
||||
|
||||
pic.crop(cropRect);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user