2013-04-18 15:48:06 +01:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
2013-04-18 14:16:18 +01:00
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);
|
|
|
|
|
|
|
|
var box1: Phaser.GeomSprite;
|
|
|
|
var box2: Phaser.GeomSprite;
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
|
|
|
box2 = myGame.createGeomSprite(300, 300).createRectangle(128, 128);
|
|
|
|
box1 = myGame.createGeomSprite(320, 100).createRectangle(64, 64);
|
|
|
|
|
|
|
|
box1.velocity.y = 50;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
|
|
if (box1.collide(box2) == true)
|
|
|
|
{
|
|
|
|
box1.fillColor = 'rgb(255,0,0)';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
box1.fillColor = 'rgb(0,255,0)';
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-04-19 18:53:21 +01:00
|
|
|
function checkPoints() {
|
|
|
|
|
|
|
|
if (box2.rect.containsPoint(box1.rect.topLeft))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-04-18 14:16:18 +01:00
|
|
|
})();
|