Example #1
0
        public Bullet(Character character, string id, Texture2D texture, Vector2 size, float speed, float lifeSpan)
            : base()
        {
            this.character = character;

            if (character.SearchChild("weapon") != null)
            {
                this.texture = texture;
                this.spriteWidth = (int)size.X;
                this.spriteHeight = (int)size.Y;
                this.speed = speed;
                this.lifeSpan = lifeSpan;
                this.SetId(id);
                if (this.character.lastState == CharacterState.MOVELEFT)
                    this._faceRight = false;
                else
                    this._faceRight = true;

                if (_faceRight)
                {
                    this.position = (character.SearchChild("weapon") as Weapon).position;
                    this.position.X += (character.SearchChild("weapon")as Weapon).SourceRect.Width;
                    this.sourceRect = new Rectangle(0, 0, spriteWidth, spriteHeight);
                }
                else
                {
                    this.position = (character.SearchChild("weapon") as Weapon).position;
                    this.position.X -= (character.SearchChild("weapon") as Weapon).LEFTOFFSET + spriteWidth;
                    this.sourceRect = new Rectangle(spriteWidth, 0, spriteWidth, spriteHeight);
                }
            }
        }
Example #2
0
 public GameObject(Character character, string id, Texture2D texture, Vector2 position, Vector2 size)
     : base(texture,0, (int)size.X, (int)size.Y)
 {
     this.character = character;
     this.id = id;
     this.speed = character.speed;
     this.parentPosition = character.position;
     this.offsetPosition = position;
     this.position = offsetPosition + parentPosition;
 }
Example #3
0
 public BulletNormal(Character character)
     : base(character, "normal", GameplayScreen.main.content.Load<Texture2D>("Weapon/Powerups/bulletNormal"), new Vector2(20, 15), 500.0f, 1.0f)
 {
 }
Example #4
0
 public BulletLaser(Character character)
     : base(character, "normal", GameplayScreen.main.content.Load<Texture2D>("Weapon/Powerups/bulletLaser"), new Vector2(30, 10), 200.0f, 1.0f)
 {
 }
Example #5
0
 public void SetTargetPlayer(Character targetPerson)
 {
     this.targetPlayer = targetPerson;
 }
Example #6
0
 public Weapon(Character character, Texture2D texture, Vector2 position, Vector2 size)
     : base(character, "weapon", texture, position, size)
 {
     shootInterval = 0.20f;
 }
Example #7
0
 public Health(Character character)
     : base(character, "health", GameplayScreen.main.content.Load<Texture2D>("Character/health"), new Vector2(0, -20), new Vector2(60, 15))
 {
 }