source: 2013/30/ViljamiV/PerusPeli4/PerusPeli4/PerusPeli4/PerusPeli4.cs @ 5521

Revision 5521, 1.1 KB checked in by koannak, 9 years ago (diff)

kk

Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class PerusPeli4 : Game
10{
11    Image shrek = LoadImage("shrek");
12    Image talo = LoadImage("talo");
13
14    public override void Begin()
15    {
16        // Kirjoita ohjelmakoodisi tähän
17        IsMouseVisible=true;
18
19        Level.Size = Screen.Size;
20
21          Level.Background.Image = talo;
22          Level.Background.ScaleToLevel();
23          Level.Background.Color = Color.Black;
24         
25        Keyboard.Listen(Key.Escape, ButtonState.Pressed, shrexit, "Lopeta peli");
26    }
27    void shrexit()
28    {
29        GameObject shreks = new GameObject(Screen.Width, Screen.Height);
30        shreks.Image = shrek;
31        Add(shreks, 3);
32
33        MultiSelectWindow exitwd = new MultiSelectWindow("Do you want to shrexit?", "Shrek", "Drek");
34        exitwd.ItemSelected += shrelect;
35        Add(exitwd);
36    }
37    void shrelect(int selection)
38    {
39        switch (selection)
40        {
41            case 0:
42                Exit();
43            break;
44        }
45    }
46   
47}
Note: See TracBrowser for help on using the repository browser.