source: 2013/27/TeemuM/Game/Game/Game/Enemies.cs @ 4394

Revision 4394, 1.3 KB checked in by teematma, 10 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Jypeli;
6using Jypeli.Assets;
7using Jypeli.Controls;
8using Jypeli.Effects;
9using Jypeli.Widgets;
10
11public class Zombie1 : PhysicsObject
12{
13
14    public IntMeter zombieHealth1;
15
16    private static Image[] Images = { Game.LoadImage("Zombie1"), Game.LoadImage("Zombie2"), Game.LoadImage("Zombie3"), Game.LoadImage("Zombie4") };
17   
18    public Zombie1(double widht, double height, double x, double y, int healt) : base(widht, height)
19    {
20        this.X = x;
21        this.Y = y;
22        this.Shape = Shape.Circle;
23        RandomTexture();
24        CreateBrain();
25        createZHealth(healt);
26
27        this.IsUpdated = true;
28    }
29
30    void createZHealth(int health)
31    {
32        zombieHealth1 = new IntMeter(health, 0, health + 10);
33
34    }
35
36    private void RandomTexture()
37    {
38        this.Image = Images[RandomGen.NextInt(Images.Length)];
39    }
40
41
42    private void CreateBrain()
43    {
44        FollowerBrain brain = new FollowerBrain("player");
45        brain.Speed = 200;
46        brain.Active = true;
47        this.Brain = brain;
48    }
49
50    public override void Update(Time time)
51    {
52        this.Angle = (G.game.player.Position - this.AbsolutePosition).Normalize().Angle - Angle.FromDegrees(90);
53        base.Update(time);
54    }
55}
Note: See TracBrowser for help on using the repository browser.