Changeset 6410 for 2015


Ignore:
Timestamp:
2015-06-25 23:28:01 (8 years ago)
Author:
sieerinn
Message:

Tulipalloja lentää.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs

    r6409 r6410  
    33using System.Diagnostics.CodeAnalysis; 
    44using System.Linq; 
     5using System.Runtime.InteropServices; 
    56using Jypeli; 
    67using Jypeli.Assets; 
     
    229230    private Animation tattiMageAnimation; 
    230231    private Animation tattiMageCastAnimation; 
     232    private Animation fireballAnimation; 
    231233 
    232234    private Animation bossRiseAnimation; 
     
    247249 
    248250    private Action activateBoss; 
     251    private Timer fireballTimer; 
    249252 
    250253    public override void Begin() 
     
    419422        bossHitAnimation = LoadAnimation("bosshit"); 
    420423        bossHurtAnimation = LoadAnimation("bosshurt"); 
     424        fireballAnimation = LoadAnimation("fireball"); 
    421425 
    422426        cameraOffset = Window.Width / 4; 
     
    511515        level.Execute(TILE_SIZE, TILE_SIZE); 
    512516 
    513         // Kolmanteen kenttään laavaseinä. 
     517        // Kolmanteen kenttään laavaseinä ja tulipalloja 
    514518        if (levelNumber == 2) 
    515519        { 
     
    532536            }; 
    533537            updateTimer.Start(); 
     538 
     539            fireballTimer = new Timer { Interval = 10.0 }; 
     540            fireballTimer.Timeout += delegate 
     541            { 
     542                var fireball = PhysicsObject.CreateStaticObject(100, 40); 
     543                fireball.IgnoresCollisionResponse = true; 
     544                fireball.Animation = new Animation(fireballAnimation); 
     545                fireball.Animation.Start(); 
     546                fireball.Y = RandomGen.SelectOne<HillBilly>(players).Position.Y; 
     547                fireball.X = Camera.X + Window.Width / 2.0; 
     548                fireball.Velocity = new Vector(-100, 0); 
     549                fireball.LifetimeLeft = TimeSpan.FromSeconds(20); 
     550                fireball.Tag = "burn"; 
     551                Add(fireball); 
     552            }; 
     553            fireballTimer.Start(); 
    534554        } 
    535555    } 
     
    14141434            if (cameraTarget.X == rightCamLimit && activateBoss != null) 
    14151435            { 
     1436                fireballTimer.Stop(); 
    14161437                activateBoss(); 
    14171438                activateBoss = null; 
Note: See TracChangeset for help on using the changeset viewer.