mirror of
https://github.com/wassname/phaser.git
synced 2026-07-26 13:27:43 +08:00
Preparing new tests
This commit is contained in:
@@ -36,7 +36,8 @@ module Phaser {
|
||||
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
|
||||
**/
|
||||
static contains(a: Circle, x: number, y: number): bool {
|
||||
return (a.radius * a.radius >= Collision.distanceSquared(a.x, a.y, x, y));
|
||||
//return (a.radius * a.radius >= Collision.distanceSquared(a.x, a.y, x, y));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +60,8 @@ module Phaser {
|
||||
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
|
||||
**/
|
||||
static containsCircle(a:Circle, b:Circle): bool {
|
||||
return ((a.radius + b.radius) * (a.radius + b.radius)) >= Collision.distanceSquared(a.x, a.y, b.x, b.y);
|
||||
//return ((a.radius + b.radius) * (a.radius + b.radius)) >= Collision.distanceSquared(a.x, a.y, b.x, b.y);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -341,65 +341,6 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load graphic for this sprite. (graphic can be SpriteSheet or Texture)
|
||||
* @param key {string} Key of the graphic you want to load for this sprite.
|
||||
* @param clearAnimations {boolean} If this Sprite has a set of animation data already loaded you can choose to keep or clear it with this boolean
|
||||
* @return {Sprite} Sprite instance itself.
|
||||
*/
|
||||
static loadTexture(sprite: Phaser.Sprite, key: string, clearAnimations: bool = true): Sprite {
|
||||
|
||||
//if (clearAnimations && sprite.animations.frameData !== null)
|
||||
//{
|
||||
// sprite.animations.destroy();
|
||||
//}
|
||||
|
||||
if (sprite.game.cache.getImage(key) !== null)
|
||||
{
|
||||
if (sprite.game.cache.isSpriteSheet(key))
|
||||
{
|
||||
sprite.texture.setTo(null, sprite.game.cache.getImage(key));
|
||||
//sprite.animations.loadFrameData(sprite._game.cache.getFrameData(key));
|
||||
//sprite.collisionMask.width = sprite.animations.currentFrame.width;
|
||||
//sprite.collisionMask.height = sprite.animations.currentFrame.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.texture.setTo(sprite.game.cache.getImage(key), null);
|
||||
sprite.frameBounds.width = sprite.texture.width;
|
||||
sprite.frameBounds.height = sprite.texture.height;
|
||||
//sprite.collisionMask.width = sprite._texture.width;
|
||||
//sprite.collisionMask.height = sprite._texture.height;
|
||||
}
|
||||
}
|
||||
|
||||
return sprite;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a DynamicTexture as its texture.
|
||||
* @param texture {DynamicTexture} The texture object to be used by this sprite.
|
||||
* @return {Sprite} Sprite instance itself.
|
||||
*/
|
||||
static loadDynamicTexture(sprite: Phaser.Sprite, texture: DynamicTexture): Sprite {
|
||||
|
||||
//if (sprite.animations.frameData !== null)
|
||||
//{
|
||||
// sprite.animations.destroy();
|
||||
//}
|
||||
|
||||
//sprite._texture = texture;
|
||||
|
||||
//sprite.frameBounds.width = sprite._texture.width;
|
||||
//sprite.frameBounds.height = sprite._texture.height;
|
||||
|
||||
//sprite._dynamicTexture = true;
|
||||
|
||||
return sprite;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates a flat colored square image dynamically.
|
||||
* @param width {number} The width of the sprite you want to generate.
|
||||
|
||||
Reference in New Issue
Block a user