コード例 #1
0
 public override void PostLoad()
 {
     SetLayerDepth(0f);
     scale      = Vector2.One * scaleSize;
     myCollider = new CircleCollider(Layer.Shield, this, 350 * scaleSize);
     position   = screenCenter;
     SetOriginInPixels(spriteSheetSpecs[0].width / 2, spriteSheetSpecs[0].height / 2);
 }
コード例 #2
0
 public override void PostLoad()
 {
     SetLayerDepth(0f);
     scale      = Vector2.One * scaleSize;
     myCollider = new CircleCollider(Layer.CannonBall, this, 50);
     SetOriginInPixels(mySpriteSheetSpecs.width / 2, mySpriteSheetSpecs.height / 2);
     //base.PostLoad();
 }
コード例 #3
0
 void CheckForCollision(){
     CircleCollider enemyCollider = myCollider.GetOverlappingCollider();
     if (enemyCollider != null){
         if (enemyCollider.layer == Layer.Enemy){
             ((Enemy)(enemyCollider.gameObject)).TakeDamage();
             Destroy();
         }
     }
 }
コード例 #4
0
        void CheckForCollision()
        {
            CircleCollider overlappingCollider = myCollider.GetOverlappingCollider();

            if (overlappingCollider != null)
            {
                if (overlappingCollider.layer == Layer.Enemy)
                {
                    overlappingCollider.gameObject.Destroy();
                    overlappingCollider.Destroy();
                    Lose();
                }
            }
        }
コード例 #5
0
        public override void Update(GameTime gameTime)
        {
            CircleCollider overlappingCollider = myCollider.GetOverlappingCollider();

            if (overlappingCollider != null)
            {
                if (overlappingCollider.layer == Layer.Enemy)
                {
                    overlappingCollider.gameObject.Destroy();
                    overlappingCollider.Destroy();
                    TakeDamage();
                }
            }
            base.Update(gameTime);
        }
コード例 #6
0
        public override void LoadContent(ContentManager Content)
        {
            content            = Content;
            mySpriteSheetSpecs = new SpriteSheetSpecs(264, 236, 12, 3, 3, 0, 0);
            redBugAnimation    = new Animation(this, mySpriteSheetSpecs, "Images/Spritesheets/Bugs/RedBug_Walk");
            //greenBugWalkAnimation = new Animation(this, mySpriteSheetSpecs, "Images/Spritesheets/Bugs/GreenBug_Walk");

            redBugAnimation.LoadContent(Content); // greenBugWalkAnimation.LoadContent(Content);
            redBugAnimation.PostLoad();           // greenBugWalkAnimation.PostLoad();

            //texturePath = "Images/bugEnemy1";
            scale      = Vector2.One * scaleSize;
            myCollider = new CircleCollider(Layer.Enemy, this, 75 * scaleSize);
            //base.LoadContent(Content);
        }
コード例 #7
0
        public override void PostLoad()
        {
            float scaleSize = 0.5f;

            radPerSec  = baseDegPerSec * (float)Math.PI / 180f;
            position   = screenCenter;
            scale      = Vector2.One * scaleSize;
            myCollider = new CircleCollider(Layer.Cannon, this, 120 * scaleSize);
            maxBalls   = 2;

            SpriteSheetSpecs megaLaserSpriteSheetSpecs = new SpriteSheetSpecs(100, 100, 9, 5, 3, 0, 0);

            megaLaserAnimation = new MegaLaserAnimation(this, megaLaserSpriteSheetSpecs, "Images/spritesheets/MegaLaser");
            megaLaserAnimation.LoadContent(content);
            megaLaserAnimation.PostLoad();
            megaLaserAnimation.SetScale(new Vector2(1, 12));
            megaLaserAnimation.SetOrigin();

            base.PostLoad();
        }