Changeset 6392 for 2015/26


Ignore:
Timestamp:
2015-06-25 19:17:53 (4 years ago)
Author:
sieerinn
Message:

Laava toimii.

Location:
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
Files:
2 edited

Legend:

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

    r6390 r6392  
    207207    private Image spikeLeftImage = LoadImage("spikeleft"); 
    208208 
     209    private Image prisonerImage = LoadImage("prisoner"); 
     210 
    209211    private Animation crawl; 
    210212    private Animation blaze; 
     
    472474        level.SetTileMethod(Color.FromHexCode("C600AC"), CreateSpike, spikeLeftImage); 
    473475 
     476        level.SetTileMethod(Color.FromHexCode("BADA55"), CreatePrisoner); // Lempivärini. 
     477 
    474478        level.Optimize(Color.Brown);    //Color.Black   //Tekee jännittäviä asioita wheatille, jos optimoidaan (tietysti). Jotenn.  
    475479        level.Execute(TILE_SIZE, TILE_SIZE); 
     
    478482        if (levelNumber == 2) 
    479483        { 
    480             PhysicsObject lava = PhysicsObject.CreateStaticObject(300, Level.Height); 
     484            GameObject lava = new GameObject(300, Level.Height); 
    481485            lava.Image = lavaWallImage; 
    482486            lava.X = Camera.ScreenToWorld(new Vector(-Window.Width / 2.0, 0)).X; 
    483             //lava.Y = Camera.ScreenToWorld(new Vector(0, 0)).Y; 
    484             Add(lava); 
     487            Add(lava, 3); 
     488 
     489            PhysicsObject lavaCollision = PhysicsObject.CreateStaticObject(50, Level.Height); 
     490            lavaCollision.IsVisible = false; 
     491            lavaCollision.Left = lava.Left; 
     492            lavaCollision.Tag = "lava"; 
     493            Add(lavaCollision); 
    485494 
    486495            var updateTimer = new Timer {Interval = 0.01}; 
     
    488497            { 
    489498                lava.Left = Camera.X - Window.Width / 2.0; 
    490                 //lava.Y = Camera.ScreenToWorld(new Vector(0, 0)).Y; 
     499                lavaCollision.Left = lava.Left; 
    491500            }; 
    492501            updateTimer.Start(); 
    493502        } 
     503    } 
     504 
     505    void CreatePrisoner(Vector position, double width, double height) 
     506    { 
     507        GameObject prisoner = new GameObject(width * 1.2, height * 2); 
     508        prisoner.Position = position; 
     509        prisoner.Y -= height / 2.0; 
     510        prisoner.Image = prisonerImage; 
     511        Add(prisoner, 1); 
    494512    } 
    495513 
     
    9931011        }); 
    9941012 
     1013        AddCollisionHandler(player, "lava", delegate(PhysicsObject p, PhysicsObject t) 
     1014        { 
     1015            player.Life.Value = player.Life.MinValue; 
     1016        }); 
     1017 
    9951018        AddCollisionHandler(player, "worm", delegate(PhysicsObject p, PhysicsObject worm) 
    9961019        { 
Note: See TracChangeset for help on using the changeset viewer.