mirror of
https://github.com/wassname/phaser.git
synced 2026-07-16 01:20:13 +08:00
More updates to BitmapData.
This commit is contained in:
@@ -95,6 +95,7 @@
|
||||
<script src="../src/input/InputHandler.js"></script>
|
||||
<script src="../src/gameobjects/Events.js"></script>
|
||||
<script src="../src/gameobjects/GameObjectFactory.js"></script>
|
||||
<script src="../src/gameobjects/BitmapData.js"></script>
|
||||
<script src="../src/gameobjects/Sprite.js"></script>
|
||||
<script src="../src/gameobjects/TileSprite.js"></script>
|
||||
<script src="../src/gameobjects/Text.js"></script>
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<script src="../src/input/InputHandler.js"></script>
|
||||
<script src="../src/gameobjects/Events.js"></script>
|
||||
<script src="../src/gameobjects/GameObjectFactory.js"></script>
|
||||
<script src="../src/gameobjects/BitmapData.js"></script>
|
||||
<script src="../src/gameobjects/Sprite.js"></script>
|
||||
<script src="../src/gameobjects/TileSprite.js"></script>
|
||||
<script src="../src/gameobjects/Text.js"></script>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari1', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('coke', 'assets/sprites/cokecan.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
game.load.image('ball', 'assets/sprites/shinyball.png');
|
||||
|
||||
}
|
||||
|
||||
var bmd;
|
||||
|
||||
function create() {
|
||||
|
||||
//game.stage.backgroundColor = '#450034';
|
||||
|
||||
bmd = game.add.bitmapData('bob', 800, 600);
|
||||
|
||||
// And apply it to 100 randomly positioned sprites
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
bmd.setPixel(game.world.randomX, game.world.randomY, Math.random() * 255, Math.random() * 255, 255);
|
||||
}
|
||||
|
||||
bmd.context.fillStyle = '#ffffff';
|
||||
bmd.context.fillRect(20,20,16,16);
|
||||
|
||||
var d = game.add.sprite(0, 0, bmd);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// bmd.clear();
|
||||
|
||||
// updateWobblyBall();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function render() {
|
||||
|
||||
// bmd.render();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user