Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using Jypeli; |
---|
4 | using Jypeli.Assets; |
---|
5 | using Jypeli.Controls; |
---|
6 | using Jypeli.Effects; |
---|
7 | using Jypeli.Widgets; |
---|
8 | |
---|
9 | public 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.