Changeset 6037 for 2015/24


Ignore:
Timestamp:
2015-06-11 18:57:39 (8 years ago)
Author:
empaheik
Message:

Verta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/24/ohjaajat/Dungeon/Dungeon/Dungeon/Dungeon.cs

    r6036 r6037  
    5151        peli.barbaarit.Remove(barbaari); 
    5252        barbaari.Destroy(); //TODO: Mitä nyt oikeasti tapahtuu, kun barbaari astuu ansaan. Meidän tapauksessa kai tapetaan saman tien. 
     53        peli.Splatter(huone.Position); 
    5354    } 
    5455} 
     
    696697    } 
    697698 
     699    public void Splatter(Vector alkupaikka) 
     700    { 
     701        for (int i = 0; i < 6; i++) 
     702        { 
     703            GameObject p = new GameObject(25, 25); 
     704            p.Color = Color.Red; 
     705            p.Position = alkupaikka + RandomGen.NextVector(0.0, RUUDUN_KOKO * 0.4); 
     706            Add(p, 3); 
     707 
     708            GameObject varjo = new GameObject(20, 10); 
     709            varjo.Position = p.Position; 
     710            varjo.Shape = Shape.Circle; 
     711            varjo.Color = Color.Lerp(Color.Black, Color.Transparent, 0.5); 
     712            Add(varjo, 2); 
     713 
     714            Vector paikka = p.Position; 
     715            Vector nopeus = RandomGen.NextVector(0.2, 3.0); 
     716            nopeus.Y *= 0.3; 
     717            double g = -0.2; // painovoima 
     718            double z = 0.0; // sijainti z-akselilla 
     719            double vz = RandomGen.NextDouble(3.5, 4.5); // nopeus z-akselilla 
     720            double angularVelocity = RandomGen.NextDouble(-1.0, 1.0) * 8; 
     721 
     722            Timer ajastin = new Timer(); 
     723            ajastin.Interval = 0.02; 
     724            ajastin.Timeout += delegate 
     725            { 
     726                vz += g; 
     727                z += vz; 
     728                paikka += nopeus; 
     729                p.Position = paikka + new Vector(0.0, 1.0) * z; 
     730                p.Angle += Angle.FromDegrees(angularVelocity); 
     731                varjo.Position = paikka; 
     732 
     733                if (z < 0.0) 
     734                { 
     735                    ajastin.Stop(); 
     736                    p.Destroy(); 
     737                    varjo.Destroy(); 
     738                } 
     739            }; 
     740            ajastin.Start(); 
     741        } 
     742    } 
     743 
    698744    protected override void Update(Time time) 
    699745    { 
Note: See TracChangeset for help on using the changeset viewer.