2014-02-09 13:36:02 +00:00
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
function preload() {
|
|
|
|
|
|
|
|
game.load.image('pic', 'assets/pics/backscroll.png');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var text;
|
2014-02-10 01:18:53 +00:00
|
|
|
var b;
|
2014-02-14 17:08:25 +00:00
|
|
|
var grd;
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
game.stage.setBackgroundColor(0x2d2d2d);
|
2014-02-09 13:36:02 +00:00
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nwith a sprinkle of\npixi dust");
|
|
|
|
// text = game.add.text(game.world.centerX, game.world.centerY, "- phaser - with a sprinkle of pixi dust");
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
text.anchor.setTo(0.5);
|
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
// text.font = 'Art of Fighting 2';
|
|
|
|
text.font = 'Arial Black';
|
|
|
|
text.fontSize = 60;
|
|
|
|
text.fontWeight = 'bold';
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
// x0, y0 - x1, y1
|
2014-02-14 17:08:25 +00:00
|
|
|
grd = text.context.createLinearGradient(0, 0, 0, text.canvas.height);
|
|
|
|
grd.addColorStop(0, '#8ED6FF');
|
|
|
|
grd.addColorStop(1, '#004CB3');
|
|
|
|
text.fill = grd;
|
2014-02-09 13:36:02 +00:00
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
// text.fill = '#ff0044';
|
2014-02-10 01:18:53 +00:00
|
|
|
// text.lineSpacing = 16;
|
2014-02-09 13:36:02 +00:00
|
|
|
text.align = 'center';
|
2014-02-09 22:48:35 +00:00
|
|
|
text.stroke = '#000000';
|
2014-02-09 13:36:02 +00:00
|
|
|
text.strokeThickness = 2;
|
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
text.setShadow(5, 5, 'rgba(0,0,0,0.5)', 5);
|
|
|
|
// text.wordWrap = true;
|
|
|
|
// text.wordWrapWidth = 50;
|
2014-02-09 22:48:35 +00:00
|
|
|
|
|
|
|
// game.input.onDown.add(change, this);
|
|
|
|
|
|
|
|
text.inputEnabled = true;
|
|
|
|
text.input.enableDrag();
|
|
|
|
|
|
|
|
text.events.onInputOver.add(over, this);
|
|
|
|
text.events.onInputOut.add(out, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function out() {
|
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
text.fill = grd;
|
2014-02-09 22:48:35 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function over() {
|
2014-02-09 13:36:02 +00:00
|
|
|
|
2014-02-09 22:48:35 +00:00
|
|
|
text.fill = '#ff00ff';
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function change() {
|
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
// text.tint = Math.random() * 0xFFFFFF;
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
2014-02-14 17:08:25 +00:00
|
|
|
// b = text.getBounds();
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
2014-02-14 17:08:25 +00:00
|
|
|
// game.debug.renderRectangle(b);
|
2014-02-09 13:36:02 +00:00
|
|
|
// game.debug.renderText(sprite.position.y, 32, 32);
|
|
|
|
|
|
|
|
}
|