-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ScaleManager and Sprite.crop bugs.
- Loading branch information
Showing
9 changed files
with
109 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
part of example; | ||
|
||
class sprites_06_dynamic_crop extends State { | ||
preload() { | ||
game.load.image('trsi', 'assets/pics/trsipic1_lazur.jpg'); | ||
} | ||
|
||
Sprite pic; | ||
Rectangle cropRect; | ||
num w; | ||
num h; | ||
|
||
create() { | ||
|
||
pic = game.add.sprite(0, 0, 'trsi'); | ||
|
||
w = pic.width; | ||
h = pic.height; | ||
|
||
cropRect = new Rectangle(0, 0, 128, 128); | ||
|
||
pic.crop(cropRect); | ||
|
||
} | ||
|
||
update() { | ||
|
||
if (game.input.x < w && game.input.y < h) { | ||
pic.x = game.input.x; | ||
pic.y = game.input.y; | ||
cropRect.x = game.input.x; | ||
cropRect.y = game.input.y; | ||
|
||
pic.updateCrop(); | ||
} | ||
|
||
} | ||
|
||
render() { | ||
game.debug.text('x: ' + game.input.x.toString() + ' y: ' + game.input.y.toString(), 32, 32); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
part of example; | ||
|
||
class sprites_09_horizontal_crop extends State{ | ||
preload() { | ||
game.load.image('trsi', 'assets/pics/trsipic1_lazur.jpg'); | ||
} | ||
|
||
Sprite pic; | ||
Rectangle cropRect; | ||
|
||
create() { | ||
|
||
pic = game.add.sprite(game.world.centerX, 550, 'trsi'); | ||
|
||
pic.anchor.setTo(0.5, 1); | ||
|
||
cropRect = new Rectangle(0, 0, 0, pic.height); | ||
|
||
// Here we'll tween the crop rect, from a width of zero to full width, and back again | ||
Tween tween = game.add.tween(cropRect).to( { 'width': pic.width }, 3000, Easing.Bounce.Out, false, 0, 1000, true); | ||
|
||
pic.crop(cropRect); | ||
|
||
tween.start(); | ||
|
||
} | ||
|
||
update () { | ||
|
||
pic.updateCrop(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: play_phaser | ||
version: 0.10.1 | ||
version: 0.10.2 | ||
description: | ||
A Dart port for Phaser.js library. | ||
author: playif <[email protected]> | ||
|