Пример #1
0
 public Enemy(Game game, Animation enemyAnimation, Player player, SpriteBatch spriteBatch)
 {
     curGame = (NinjaDashGame)game;
     viewport = curGame.GraphicsDevice.Viewport;
     random = new Random();
     this.enemyAnimation = enemyAnimation;
     this.player = player;
     this.spriteBatch = spriteBatch;
     Active = true;
 }
Пример #2
0
        public Gem(Game game, Animation animation, Vector2 position, Player player)
        {
            curGame = game;
            gemAnimation = animation;
            Position = position;
            this.player = player;
            Active = true;

            initialYPosition = player.Position.Y;
        }
Пример #3
0
        public EnemyWithObject(Game game, Player player, SpriteBatch spriteBatch, NumberOfObjects numberOfObjects, AnimationStore animationStore)
            : base(game, new Animation(animationStore["EnemyRun"]), player, spriteBatch)
        {
            curGame = game;
            this.spriteBatch = spriteBatch;
            relativePlayer = player;

            this.numberOfObjects = numberOfObjects;
            this.animationStore = animationStore;

            totalTimeElapsed = TimeSpan.Zero;
            timeDelay = TimeSpan.FromSeconds(0.10);

            soundEffectPlayed = false;
        }
Пример #4
0
        public void Initialize(Texture2D obstacleTexture, Player player, SpawnSide side)
        {
            viewport = curGame.GraphicsDevice.Viewport;

            texture = obstacleTexture;
            this.player = player;

            //Initially set the object to active
            Active = true;

            //Set starting positions of the object
            leftPosition = new Vector2(0, player.Position.Y - player.marginVertical - player.verticalOffset);
            rightPosition = new Vector2(viewport.Width - texture.Width, player.Position.Y - player.marginVertical - player.verticalOffset);

            if (side == SpawnSide.Left)
            {
                flip = SpriteEffects.None;
                Position = leftPosition;
            }
            else if (side == SpawnSide.Right)
            {
                flip = SpriteEffects.FlipHorizontally;
                Position = rightPosition;
            }

            initialYPosition = player.Position.Y;
        }