mirror of
https://github.com/photonstorm/phaser
synced 2025-01-25 03:15:15 +00:00
25 lines
725 B
JavaScript
25 lines
725 B
JavaScript
|
|
||
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||
|
|
||
|
function preload() {
|
||
|
|
||
|
// You can fill the preloader with as many assets as your game requires
|
||
|
|
||
|
// Here we are loading an image. The first parameter is the unique
|
||
|
// string by which we'll identify the image later in our code.
|
||
|
|
||
|
// The second parameter is the URL of the image (relative)
|
||
|
game.load.image('einstein', 'assets/pics/ra_einstein.png');
|
||
|
}
|
||
|
|
||
|
function create() {
|
||
|
|
||
|
// This creates a simple sprite that is using our loaded image and
|
||
|
// displays it on-screen
|
||
|
// and assign it to a variable
|
||
|
var image = game.add.sprite(0, 0, 'einstein');
|
||
|
|
||
|
image.body.velocity.x=50;
|
||
|
|
||
|
}
|