예제 #1
0
파일: Enemy.cs 프로젝트: endert/Intro2D
 /// <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;
 }
예제 #2
0
파일: Enemy.cs 프로젝트: endert/Intro2D
 /// <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);
 }
예제 #3
0
파일: Program.cs 프로젝트: endert/Intro2D
 /// <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");
 }
예제 #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);
예제 #5
0
파일: Player.cs 프로젝트: endert/Intro2D
 /// <summary>
 /// Calls the Move methode
 /// </summary>
 public override void Update(GameTime gTime)
 {
     movementSpeed = baseMovementSpeed * gTime.Ellapsed.Milliseconds;
     KeyboardInput();
     Move();
 }