Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CGruntProjectile : CEntity
- {
- private bool myAlive;
- public CGruntProjectile(CGame game, Texture2D texture)
- : base(game, texture)
- {
- myAlive = false;
- }
- public bool Alive
- {
- get
- {
- return myAlive;
- }
- set
- {
- myAlive = value;
- }
- }
- public void Fire(float x, float y)
- {
- myPosition.X = (x + (myGame.player.Width / 2));
- myPosition.Y = (y + (myGame.player.Height));
- myAlive = true;
- }
- public void Tick()
- {
- if (Alive == false)
- {
- return;
- }
- myPosition.Y += 5f;
- if (myPosition.Y > myGame.Width)
- {
- myAlive = false;
- return;
- }
- if (this.CollisionBox.Intersects(myGame.player.CollisionBox))
- {
- myAlive = false;
- myGame.player.Death();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement