Ignore:
Timestamp:
2015-06-23 22:41:48 (5 years ago)
Author:
sieerinn
Message:

Kuvia. Kuvia kaikkialla.

File:
1 edited

Legend:

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

    r6216 r6217  
    7272 
    7373    private Image cartImage = LoadImage("cart"); 
    74     private Image milkImage = LoadImage("tonkka"); 
     74    private Image milkImage = LoadImage("tonkkaitem"); 
    7575     
    7676    private Image cartWheelImage = LoadImage("cartwheel"); 
     
    7979    private Image smokeImage2 = LoadImage("smoke2"); 
    8080 
     81    private Image forestBackgroundImage = LoadImage("forestbackground"); 
     82 
    8183    private Animation crawl; 
    8284    private Animation blaze; 
     85 
     86    private Animation pitchforkAttack; 
     87    private Animation pitchforkWalk; 
     88    private Animation milkThrow; 
     89    private Animation milkWalk; 
     90    private Animation normalWalk; 
     91    private Animation playerIdle; 
    8392    #endregion  
    8493 
     
    91100    public override void Begin() 
    92101    { 
    93         IntroSequence(); 
     102        //IntroSequence(); 
    94103        //MainMenu(); 
    95         //StartGame(); 
     104        StartGame(); 
    96105    } 
    97106 
     
    221230        CreateLevel(); 
    222231        ScreenSettings(); 
     232 
     233        // Taustatestailua. 
     234        GameObject forestBackground = new GameObject(Level.Width, Level.Height); 
     235        forestBackground.Image = forestBackgroundImage; 
     236        forestBackground.TextureWrapSize = new Vector(5, 1); 
     237        Add(forestBackground, -3); 
     238        Layers[-3].RelativeTransition = new Vector(0.5, 1.0); 
     239        Level.Background.CreateGradient(Color.Black, Color.SkyBlue); 
    223240 
    224241        // Testailen tässä kärryn luomista. 
     
    243260        crawl = LoadAnimation("crawl"); 
    244261        blaze = LoadAnimation("flame"); 
     262        pitchforkAttack = LoadAnimation("attack"); 
     263        pitchforkWalk = LoadAnimation("hanko"); 
     264        milkThrow = LoadAnimation("heitto"); 
     265        milkWalk = LoadAnimation("tonkka"); 
     266        normalWalk = LoadAnimation("pwalk"); 
     267        playerIdle = LoadAnimation("idle"); 
    245268    } 
    246269 
     
    285308        //level.SetTileMethod(Color.Azure, CreateDummy, Color.Azure);   //TODO: CreateSmoke 
    286309        //level.SetTileMethod(Color.Orange, CreateDummy, Color.Orange); //TODO: CreateTombstone 
     310        level.Optimize(Color.Black, Color.Brown); 
    287311        level.Execute(TILE_SIZE, TILE_SIZE); 
    288         level.Optimize(Color.Black, Color.Brown); 
     312         
    289313 
    290314        //TileMap level = TileMap.FromLevelAsset("level" + levelNumber); 
     
    419443        player.Position = position + new Vector(0, height * 0.5); 
    420444        player.Color = Color.White; 
     445        player.AnimWalk = new Animation(normalWalk); 
     446        player.AnimIdle = new Animation(playerIdle); 
    421447        players.Add(player); 
    422448        startingPlayers.Add(player); 
     
    427453            billy.Life.Value--; 
    428454 
    429         } 
    430         ); 
     455        }); 
    431456 
    432457        player.Life.LowerLimit += delegate  
     
    460485        if (wheat) 
    461486        { 
    462             GameObject wheatBlock = new GameObject(width * 1.5, height * 3); 
     487            GameObject wheatBlock = new GameObject(width * 1.5, height * 2); 
    463488            wheatBlock.Image = foregroundDecorations[0]; 
    464             wheatBlock.Position = visibleGround.Position; 
     489            wheatBlock.X = visibleGround.X; 
     490            wheatBlock.Bottom = visibleGround.Bottom; 
     491            wheatBlock.TextureWrapSize = new Vector(width / TILE_SIZE, height / TILE_SIZE); 
    465492            Add(wheatBlock, 2); 
    466493        } 
     
    479506    void SetControls() 
    480507    { 
    481         Keyboard.Listen(Key.A, ButtonState.Down, delegate { startingPlayers[0].Walk(-300); }, "Player 1 moves left"); 
    482         Keyboard.Listen(Key.D, ButtonState.Down, delegate { startingPlayers[0].Walk(300); }, "Player 1 moves right"); 
     508        double speed = 180; // TODO: Siirrä tämä johonkin. 
     509        Keyboard.Listen(Key.A, ButtonState.Down, delegate { startingPlayers[0].Walk(-speed); }, "Player 1 moves left"); 
     510        Keyboard.Listen(Key.D, ButtonState.Down, delegate { startingPlayers[0].Walk(speed); }, "Player 1 moves right"); 
    483511        Keyboard.Listen(Key.W, ButtonState.Down, delegate { startingPlayers[0].Jump(1000); }, "Player 1 jumps"); 
    484512 
    485         Keyboard.Listen(Key.Left, ButtonState.Down, delegate { startingPlayers[1].Walk(-300); }, "Player 2 moves left"); 
    486         Keyboard.Listen(Key.Right, ButtonState.Down, delegate { startingPlayers[1].Walk(300); }, "Player 2 moves right"); 
     513        Keyboard.Listen(Key.Left, ButtonState.Down, delegate { startingPlayers[1].Walk(-speed); }, "Player 2 moves left"); 
     514        Keyboard.Listen(Key.Right, ButtonState.Down, delegate { startingPlayers[1].Walk(speed); }, "Player 2 moves right"); 
    487515        Keyboard.Listen(Key.Up, ButtonState.Down, delegate { startingPlayers[1].Jump(1000); }, "Player 2 jumps"); 
    488516 
Note: See TracChangeset for help on using the changeset viewer.