mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
First commi using the new software
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
function create() {
|
||||
|
||||
//make the world larger than the actual canvas
|
||||
game.world.setBounds(1400,1400);
|
||||
game.world.setBounds(0,0,1400,1400);
|
||||
|
||||
for(var i=0,nb=10;i<nb;i++){
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
// Make our game world 2000x2000 pixels in size (the default is to match the game size)
|
||||
game.world.setBounds(2000, 2000);
|
||||
game.world.setBounds(0,0,2000, 2000);
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
<?php
|
||||
$title = "Moving the game camera with the keyboard";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.tilemap('snes', 'assets/maps/smb_tiles.png', 'assets/maps/smb_level1.json', null, Phaser.Tilemap.JSON);
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
|
||||
//setting the size of the game world larger than the tilemap's size
|
||||
game.world.setBounds(2000,2000);
|
||||
|
||||
game.stage.backgroundColor = '#255d3b';
|
||||
|
||||
// adding the tilemap
|
||||
game.add.tilemap(0, 150, 'snes');
|
||||
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
game.camera.x -= 8;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
game.camera.x += 8;
|
||||
}
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
game.camera.y -= 8;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN))
|
||||
{
|
||||
game.camera.y += 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user