source: 2014/30/EevaS/Zombie attack!/Zombie attack!/Zombie attack!/Zombie_attack_.cs @ 5579

Revision 5579, 1.7 KB checked in by eemalisa, 9 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class Zombie_attack_ : Game
10{
11    PhysicsObject pelaaja;
12
13    public override void Begin()
14    {
15        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
16    }
17
18    void LuoKentta()
19    {
20        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Kenttä");
21
22        ruudut.SetTileMethod(Color.Harlequin, LuoPelaaja);
23        ruudut.SetTileMethod(Color.Black, LuoTaso);
24        ruudut.SetTileMethod(Color.Gold, LuoTahti);
25        ruudut.SetTileMethod(Color.Red, LuoVihollinen);
26
27        ruudut.Execute(20, 20);
28    }
29
30    void LuoPelaaja(Vector paikka, double leveys, double korkeus)
31    {
32        pelaaja = new PhysicsObject(10, 10);
33        pelaaja.Position = paikka;
34        //AddCollisionHandler(LuoPelaaja, "tahti", TormaaTahteen);
35        Add(pelaaja);
36    }
37
38    void LuoTaso(Vector paikka, double leveys, double korkeus)
39    {
40        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus);
41        taso.Position = paikka;
42        //taso.Image 0 groundImage;
43        taso.CollisionIgnoreGroup = 1;
44        Add(taso);
45    }
46
47    void LuoTahti(Vector paikka, double leveys, double korkeus)
48    {
49        PhysicsObject tahti = PhysicsObject.CreateStaticObject(10.0, 10.0);
50        tahti.IgnoresCollisionResponse = true;
51        tahti.Position = paikka;
52        //tahti.Image = tahdenKuva;
53        tahti.Tag = "tahti";
54        Add(tahti, 1);
55    }
56
57    void LuoVihollinen(Vector paikka, double leveys, double korkeus)
58    {
59        PhysicsObject zombi = new PhysicsObject(40, 20);
60
61    }
62
63
64
65
66
67
68
69}
Note: See TracBrowser for help on using the repository browser.