Exemplo n.º 1
0
 /// <summary>
 /// animates the enemy by switching the texture of the sprite
 /// </summary>
 /// <param name="gTime"></param>
 protected void Animate(GameTime gTime)
 {
     if (gTime.Total.Milliseconds % 1000 < 500)
         sprite.Texture = textur;
     else
         sprite.Texture = textur2;
 }
Exemplo n.º 2
0
 /// <summary>
 /// calls the move Methode
 /// </summary>
 public override void Update(GameTime gTime)
 {
     movementSpeed = baseMovementSpeed * gTime.Ellapsed.Milliseconds;
     MovingDirection = Program.Player.Position - sprite.Position;
     Move();
     if (isMoving)
         Animate(gTime);
 }
Exemplo n.º 3
0
 /// <summary>
 /// initialize Player and Enemies, by calling the constructors
 /// </summary>
 public static void Initialize()
 {
     gTime = new GameTime();
     map = new Map(new System.Drawing.Bitmap("Pictures/Map.bmp"));
     Player = new Player(new Vector2f(map.TileSize + 30,map.TileSize + 30));
     enemy1 = new Enemy("Pictures/EnemyGreen.png", new Vector2f(800, 100), "Pictures/EnemyGreenMove.png");
     enemy2 = new Enemy("Pictures/EnemyRed.png", new Vector2f(100, 600), "Pictures/EnemyGreenMove.png");
 }
Exemplo n.º 4
0
 /// <summary>
 /// abstract Methode, must be implemented by all subclasses which are not abstract
 /// <para>shall Update this instance by calling all needed Methods</para>
 /// </summary>
 public abstract void Update(GameTime gTime);
Exemplo n.º 5
0
 /// <summary>
 /// Calls the Move methode
 /// </summary>
 public override void Update(GameTime gTime)
 {
     movementSpeed = baseMovementSpeed * gTime.Ellapsed.Milliseconds;
     KeyboardInput();
     Move();
 }