|
| 1 | + |
| 2 | +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }, false); |
| 3 | +// var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create, update: update, render: render }, false); |
| 4 | + |
| 5 | +function preload() { |
| 6 | + |
| 7 | + game.load.image('pic', 'assets/pics/backscroll.png'); |
| 8 | + |
| 9 | +} |
| 10 | + |
| 11 | +var text; |
| 12 | + |
| 13 | +function create() { |
| 14 | + |
| 15 | + game.stage.backgroundColor = '#c48844'; |
| 16 | + |
| 17 | + text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nwith a sprinkle of\npixi dust"); |
| 18 | + |
| 19 | + text.anchor.setTo(0.5); |
| 20 | + |
| 21 | + text.font = 'Art of Fighting 2'; |
| 22 | + // text.font = 'Arial'; |
| 23 | + text.fontSize = 40; |
| 24 | + // text.fontWeight = 'bold italic'; |
| 25 | + |
| 26 | + // x0, y0 - x1, y1 |
| 27 | + var grd = text.context.createLinearGradient(0, 0, 0, text.canvas.height); |
| 28 | + |
| 29 | + grd.addColorStop(0, '#8ED6FF'); |
| 30 | + grd.addColorStop(1, '#004CB3'); |
| 31 | + |
| 32 | + // text.fill = '#ff0044'; |
| 33 | + // text.lineSpacing = 16; |
| 34 | + text.fill = grd; |
| 35 | + text.align = 'center'; |
| 36 | + text.stroke = '#ff00ff'; |
| 37 | + text.strokeThickness = 2; |
| 38 | + |
| 39 | + text.setShadow(5, 5, 'rgba(0,0,0,0.5)', 5); |
| 40 | + |
| 41 | + game.input.onDown.add(change, this); |
| 42 | + |
| 43 | +} |
| 44 | + |
| 45 | +function change() { |
| 46 | + |
| 47 | + text.tint = Math.random() * 0xFFFFFF; |
| 48 | + |
| 49 | +} |
| 50 | + |
| 51 | +function update() { |
| 52 | + |
| 53 | + |
| 54 | +} |
| 55 | + |
| 56 | +function render() { |
| 57 | + |
| 58 | + // game.debug.renderText(sprite.position.y, 32, 32); |
| 59 | + |
| 60 | +} |
0 commit comments