phaser/wip/examples/signals.html

35 lines
774 B
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<title>phaser.js - a(nother) new beginning</title>
<script src="../src/Phaser.js"></script>
<script src="../src/core/SignalBinding.js"></script>
<script src="../src/core/Signal.js"></script>
<script src="../src/math/RandomDataGenerator.js"></script>
<script src="../src/Game.js"></script>
</head>
<body>
<script type="text/javascript">
function action(aString, aNumber, aObject) {
console.log('Signal received:', aString, aNumber, aObject);
}
var game = new Phaser.Game(this, '', 800, 600);
// create a new signal
var s = new Phaser.Signal();
// add a listener to it (the 'action' function)
s.add(action, this);
// dispatch it with some parameters
s.dispatch('Atari forever', 520, { x: 100, y: 200 });
</script>
</body>
</html>