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