mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Tween.generateData(frameRate) allows you to generate tween data into an array, which can then be used however you wish (see new examples)
Added new Retro Font examples.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.bitmapFont('shortStack', 'assets/fonts/bitmapFonts/shortStack.png', 'assets/fonts/bitmapFonts/shortStack.fnt');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.bitmapText(32, 32, 'shortStack', 'This font was generated using the\nfree Littera web site\n\nhttp://kvazars.com/littera/', 32);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
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/retroFonts/KNIGHT3.png');
|
||||
|
||||
}
|
||||
|
||||
var font;
|
||||
|
||||
function create() {
|
||||
|
||||
font = game.add.retroFont('knightHawks', 31, 25, Phaser.RetroFont.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);
|
||||
i.tint = Math.random() * 0xFFFFFF;
|
||||
i.anchor.set(0.5, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('goldFont', 'assets/fonts/retroFonts/gold_font.png');
|
||||
game.load.image('bluePink', 'assets/fonts/retroFonts/bluepink_font.png');
|
||||
game.load.image('forgotten', 'assets/pics/forgotten_worlds.png');
|
||||
|
||||
}
|
||||
|
||||
var font1;
|
||||
var font2;
|
||||
var image1;
|
||||
var image2;
|
||||
|
||||
function create() {
|
||||
|
||||
font1 = game.add.retroFont('goldFont', 16, 16, "! :() ,?." + Phaser.RetroFont.TEXT_SET10, 20, 0, 0);
|
||||
font1.text = "phaser brings you retro style bitmap fonts";
|
||||
|
||||
image1 = game.add.image(game.world.centerX, 48, font1);
|
||||
image1.anchor.set(0.5);
|
||||
|
||||
font2 = game.add.retroFont('bluePink', 32, 32, Phaser.RetroFont.TEXT_SET2, 10);
|
||||
font2.setText("phaser 2\nin the house", true, 0, 8, Phaser.RetroFont.ALIGN_CENTER);
|
||||
|
||||
image2 = game.add.image(game.world.centerX, 220, font2);
|
||||
image2.anchor.set(0.5);
|
||||
|
||||
game.add.image(0, game.height - 274, 'forgotten');
|
||||
|
||||
game.time.events.loop(Phaser.Timer.SECOND * 2, change, this);
|
||||
|
||||
}
|
||||
|
||||
function change() {
|
||||
|
||||
image2.tint = Math.random() * 0xFFFFFF;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
image2.rotation += (2 * game.time.physicsElapsed);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user