-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.cs
49 lines (44 loc) · 1.43 KB
/
Enemy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
namespace ProjektPO
{
class Enemy
{
protected Animation runanimation;
protected Animation idleanimation;
protected AnimationPlayer sprite;
protected Level level;
protected Vector2 position;
protected Rectangle localrectangle;
public Rectangle boundingrectangle
{
get
{
int left = (int)Math.Round(position.X - sprite.Origin.X) + localrectangle.X;
int top = (int)Math.Round(position.Y - sprite.Origin.Y) + localrectangle.Y;
return new Rectangle(left, top, localrectangle.Width, localrectangle.Height);
}
}
protected FaceDirection direction = FaceDirection.Left;
protected float waitTime;
protected const float MaxWaitTime = 0.5f;
protected const float MoveSpeed = 64.0f;
public Enemy(Level level, Vector2 position, string spriteset)
{
this.level = level;
this.position = position;
LoadContent(spriteset);
}
public virtual void LoadContent(string spriteSet)
{
}
public virtual void Update(GameTime gameTime)
{
}
public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
}
}
}