Merge pull request #1672 from vlidholt/master

Makes sprite physics bodies scalable
This commit is contained in:
Viktor Lidholt
2015-10-19 12:30:02 -07:00
5 changed files with 96 additions and 38 deletions

View File

@@ -55,6 +55,7 @@ class TestBed extends NodeWithSize {
_obstacle = new Sprite(_spriteSheet["ship.png"]);
_obstacle.position = new Point(512.0, 800.0);
_obstacle.size = new Size(64.0, 64.0);
_obstacle.scale = 2.0;
_obstacle.physicsBody = new PhysicsBody(
new PhysicsShapeCircle(Point.origin, 32.0),
type: PhysicsBodyType.static,
@@ -71,6 +72,12 @@ class TestBed extends NodeWithSize {
]);
_obstacle.actions.run(new ActionRepeatForever(seq));
seq = new ActionSequence([
new ActionTween((a) => _obstacle.scale = a, 1.0, 2.0, 2.0, easeInOut),
new ActionTween((a) => _obstacle.scale = a, 2.0, 1.0, 2.0, easeInOut)
]);
_obstacle.actions.run(new ActionRepeatForever(seq));
addChild(_physicsNode);
userInteractionEnabled = true;