Commit 37d0c1a8 authored by Viktor Lidholt's avatar Viktor Lidholt

Adds small explosions to demo game

parent 6de024f0
......@@ -81,5 +81,29 @@ class ExplosionBig extends Explosion {
}
class ExplosionMini extends Explosion {
ExplosionMini(SpriteSheet sheet) {
for (int i = 0; i < 2; i++) {
Sprite star = new Sprite(sheet["star_0.png"]);
star.scale = 0.5;
star.colorOverlay = new Color(0xff95f4fb);
star.transferMode = sky.TransferMode.plus;
addChild(star);
double rotationStart = randomDouble() * 90.0;
double rotationEnd = 180.0 + randomDouble() * 90.0;
if (i == 0) {
rotationStart = -rotationStart;
rotationEnd = -rotationEnd;
}
ActionTween rotate = new ActionTween((a) => star.rotation = a, rotationStart, rotationEnd, 0.2);
actions.run(rotate);
ActionTween fade = new ActionTween((a) => star.opacity = a, 1.0, 0.0, 0.2);
actions.run(fade);
}
ActionSequence seq = new ActionSequence([new ActionDelay(0.2), new ActionRemoveNode(this)]);
actions.run(seq);
}
}
......@@ -165,6 +165,10 @@ class Laser extends GameObject {
void move() {
position += _offset;
}
Explosion createExplosion() {
return new ExplosionMini(f.sheet);
}
}
Color colorForDamage(double damage, double maxDamage) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment