Exemplo n.º 1
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     Camera.setupGenericTexture(GraphicsDevice);
     TextureManager.loadAllImages(Content);
     currentScreen = new MainMenu();
     LevelData.Load();
     Enemy.Load();
     SFXManager.Load(Content);
     // TODO: use this.Content to load your game content here
 }
Exemplo n.º 2
0
        public override void OnReachedTile()
        {
            SFXManager.PlayPiano();
            for (int i = 0; i < 4; i++)
            {
                valid[i] = false;
                Point target = MoveDir(tile, i);
                if (isInBounds(target))
                {
                    valid[i] = true;
                }
                if (((direction == 0 || direction == 2) && (i == 0 || i == 2)) || ((direction == 1 || direction == 3) && (i == 1 || i == 3)))
                {
                    valid[i] = false;
                }
            }

            int xDist = player.currentPos.X - currentPos.X;
            int yDist = player.currentPos.Y - currentPos.Y;

            if (Math.Abs(xDist) > Math.Abs(yDist))
            {
                if (xDist > 0 && valid[0])
                {
                    direction = 0;
                }
                else if (xDist < 0 && valid[2])
                {
                    direction = 2;
                }
                else if (yDist > 0 && valid[3])
                {
                    direction = 3;
                }
                else if (yDist < 0 && valid[1])
                {
                    direction = 1;
                }
            }
            else
            {
                if (yDist > 0 && valid[3])
                {
                    direction = 3;
                }
                else if (yDist < 0 && valid[1])
                {
                    direction = 1;
                }
                else if (xDist > 0 && valid[0])
                {
                    direction = 0;
                }
                else if (xDist < 0 && valid[2])
                {
                    direction = 2;
                }
            }

            if (!valid[direction])
            {
                for (int i = 0; i < 4; i++)
                {
                    if (valid[i])
                    {
                        direction = i;
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void OnReachedTile()
        {
            if (notespawntime != 0)
            {
                notespawntime--;
            }
            if (GlobalRandom.random.NextDouble() < .05f && notespawntime == 0)
            {
                bool occu = false;
                foreach (Note n in myMap.allNotes)
                {
                    if (n.currentPos.Equals(currentPos))
                    {
                        occu = true;
                    }
                }
                if (!occu)
                {
                    myMap.allNotes.Add(new Note(currentPos));
                    notespawntime = MIN_SPAWN_TIME;
                    SFXManager.PlayE3Spawn();
                }
            }

            for (int i = 0; i < 4; i++)
            {
                valid[i] = false;
                Point target = MoveDir(tile, i);
                if (isInBounds(target))
                {
                    if (myMap.myData.Map[target.X, target.Y] != 0)
                    {
                        valid[i] = true;
                    }
                }
                if ((direction == 0 && i == 2) || (direction == 2 && i == 0) || (direction == 1 && i == 3) || (direction == 3 && i == 1))
                {
                    valid[i] = false;
                }
            }

            int xDist = player.currentPos.X - currentPos.X;
            int yDist = player.currentPos.Y - currentPos.Y;

            if (Math.Abs(xDist) > Math.Abs(yDist))
            {
                if (xDist > 0 && valid[2])
                {
                    direction = 2;
                }
                else if (xDist < 0 && valid[0])
                {
                    direction = 0;
                }
            }
            else
            {
                if (yDist > 0 && valid[1])
                {
                    direction = 1;
                }
                else if (yDist < 0 && valid[3])
                {
                    direction = 3;
                }
            }

            if (!valid[direction])
            {
                for (int i = 0; i < 4; i++)
                {
                    if (valid[i])
                    {
                        direction = i;
                    }
                }
            }
        }