Couple of new labs tests.

This commit is contained in:
photonstorm
2014-02-14 17:08:25 +00:00
parent 539a0f2256
commit bcd31499c4
3 changed files with 104 additions and 21 deletions
+36
View File
@@ -0,0 +1,36 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
function preload() {
game.load.image('knightHawks', 'assets/fonts/KNIGHT3.png');
}
var font;
var i;
function create() {
font = game.add.bitmapFont('knightHawks', 31, 25, Phaser.BitmapFont.TEXT_SET6, 10, 1, 1);
font.text = 'phaser was here';
for (var c = 0; c < 19; c++)
{
var i = game.add.image(game.world.centerX, c * 32, font);
if (game.renderType === Phaser.WEBGL)
{
i.tint = Math.random() * 0xFFFFFF;
}
i.anchor.set(0.5, 1);
}
}
function update() {
font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
}
+47
View File
@@ -0,0 +1,47 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { create: create });
var text;
var grd;
function create() {
game.stage.setBackgroundColor(0x2d2d2d);
text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nwith a sprinkle of\npixi dust");
text.anchor.setTo(0.5);
text.font = 'Arial Black';
text.fontSize = 60;
text.fontWeight = 'bold';
grd = text.context.createLinearGradient(0, 0, 0, text.canvas.height);
grd.addColorStop(0, '#8ED6FF');
grd.addColorStop(1, '#004CB3');
text.fill = grd;
text.align = 'center';
text.stroke = '#000000';
text.strokeThickness = 2;
text.setShadow(5, 5, 'rgba(0,0,0,0.5)', 5);
text.inputEnabled = true;
text.input.enableDrag();
text.events.onInputOver.add(over, this);
text.events.onInputOut.add(out, this);
}
function out() {
text.fill = grd;
}
function over() {
text.fill = '#ff00ff';
}