Advertisement
ada1711

Untitled

Jul 5th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. namespace SpaceInvaders.GameObjects
  2. {
  3. public class Bullet : GameObject
  4. {
  5. public bool IsPlayerBullet { get; }
  6.  
  7. public Bullet(Vector2D position, bool isPlayerBullet) : base(position, Constants.BULLET_SIZE, Color.White)
  8. {
  9. IsPlayerBullet = isPlayerBullet;
  10. }
  11.  
  12. public override void Update()
  13. {
  14. Move(new Vector2D(0, IsPlayerBullet ? -Constants.BULLET_SPEED : Constants.BULLET_SPEED));
  15. if (Position.Y < 0 || Position.Y > 600)
  16. {
  17. IsActive = false;
  18. }
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement