mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
Input Handler 90% there.
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
<script src="../src/input/Touch.js"></script>
|
||||
<script src="../src/input/InputHandler.js"></script>
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/gameobjects/Events.js"></script>
|
||||
<script src="../src/gameobjects/GameObjectFactory.js"></script>
|
||||
<script src="../src/gameobjects/Sprite.js"></script>
|
||||
<script src="../src/gameobjects/TileSprite.js"></script>
|
||||
|
||||
@@ -46,11 +46,11 @@
|
||||
list = new Phaser.LinkedList();
|
||||
|
||||
list.add(a.input);
|
||||
// list.add(b.input);
|
||||
// list.add(c.input);
|
||||
// list.add(d.input);
|
||||
// list.add(e.input);
|
||||
// list.add(f.input);
|
||||
list.add(b.input);
|
||||
list.add(c.input);
|
||||
list.add(d.input);
|
||||
list.add(e.input);
|
||||
list.add(f.input);
|
||||
|
||||
list.dump();
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>phaser.js - a new beginning</title>
|
||||
<?php
|
||||
require('js.php');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('ship', 'assets/sprites/mana_card.png');
|
||||
}
|
||||
|
||||
var a;
|
||||
var p = new Phaser.Point;
|
||||
|
||||
function create() {
|
||||
|
||||
a = game.add.sprite(game.world.centerX, game.world.centerX, 'ship');
|
||||
a.name = 'sh';
|
||||
a.inputEnabled = true;
|
||||
a.angle = 30;
|
||||
|
||||
a.events.onInputDown.add(clicked, this);
|
||||
|
||||
}
|
||||
|
||||
function clicked (sprite, pointer) {
|
||||
|
||||
sprite.alpha -= 0.1;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.renderText('over: ' + a.input.checkPointerOver(game.input.activePointer), 32, 32);
|
||||
|
||||
|
||||
// game.debug.renderPoint(p, 'rgb(255,255,0)');
|
||||
// game.debug.renderText('px: ' + game.input.activePointer.x, 32, 32);
|
||||
// game.debug.renderText('py: ' + game.input.activePointer.y, 32, 64);
|
||||
// game.debug.renderPointer(game.input.activePointer);
|
||||
game.debug.renderSpriteInputInfo(a, 32, 32);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user