예제 #1
0
파일: Hitbox.cs 프로젝트: M4T1A5/FGJ2013
        public void AtDoor(Player player, int DrugsCount)
        {
            var playerRectangle = new Rectangle((int)player.position.X + 10, (int)player.position.Y + 45, 35, 35);
            foreach (var door in doors[DrugsCount])
            {
                if (door.Intersects(new Rectangle((int)player.position.X + 9,
                    (int)player.position.Y + 44, 37, 37)))
                {
                    Vector2 difference = new Vector2((playerRectangle.Location.X + playerRectangle.Width / 2) - (door.Location.X + door.Width / 2),
                        (playerRectangle.Location.Y + playerRectangle.Height / 2) - (door.Location.Y + door.Height / 2)); // vector from door to player

                    if (Math.Abs(difference.Y) > Math.Abs(difference.X))
                    {
                        if (difference.Y < 0) // above
                        {
                            player.position.Y += door.Height * 4;
                            break;
                        }
                        else if (difference.Y > 0) // below
                        {
                            player.position.Y -= door.Height * 4;
                            break;
                        }

                    }
                    else if (Math.Abs(difference.X) > Math.Abs(difference.Y))
                    {
                        if (difference.X < 0) // left
                        {
                            player.position.X += door.Width * 4;
                            break;
                        }
                        else if (difference.X > 0) // right
                        {
                            player.position.X -= door.Width * 4;
                            break;
                        }
                    }

                    Debug.WriteLine("Suddenly door " + door.Location + player.position);
                }
            }
        }
예제 #2
0
파일: Game1.cs 프로젝트: M4T1A5/FGJ2013
        void Reset()
        {
            //reset tiles back to normal
            heartbeatInstance.Stop(true);
            DrugsCount = -1;
            CollectDrug();
            player = new Player(PlayerTexture, new Vector2(55));
            enemies = new List<Enemy>
            {
                new Enemy(NurseTexture, new Vector2(550, 255), Enemy.EnemyType.Nurse),
                new Enemy(NurseTexture, new Vector2(2090, 933), Enemy.EnemyType.Nurse),
                new Enemy(NurseTexture, new Vector2(1645, 735), Enemy.EnemyType.Nurse),
                new Enemy(NurseTexture, new Vector2(1027, 1042), Enemy.EnemyType.Nurse),
                new Enemy(NurseTexture, new Vector2(1525, 1025), Enemy.EnemyType.Nurse),

                new Enemy(DoctorTexture, new Vector2(2133, 254), Enemy.EnemyType.Doctor),
                new Enemy(DoctorTexture, new Vector2(1197, 638), Enemy.EnemyType.Doctor),
            };

            for (var i = 0; i < map.ObjectLayers[0].MapObjects.Count<MapObject>(); i++)
            {
                if (pillLocations[i] != Rectangle.Empty)
                {
                    map.ObjectLayers[0].MapObjects[i].Bounds = pillLocations[i];
                    pillLocations[i] = Rectangle.Empty;
                }
            }

            instance.Stop(true);
            instance = MenuMusic.CreateInstance();
            instance.IsLooped = true;
            instance.Volume = volume;
            instance.Play();

            Data.GameState = State.Menu;
        }
예제 #3
0
파일: Game1.cs 프로젝트: M4T1A5/FGJ2013
        /// <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);

            PlayerTexture = Content.Load<Texture2D>("Animations/AllCharacterAnimations");
            PlayerTextureDark = Content.Load<Texture2D>("Animations/AllCharacterAnimationsDark");
            DoctorTexture = Content.Load<Texture2D>("Animations/AllCharacterAnimationsDoctor");
            DoctorTextureDark = Content.Load<Texture2D>("Animations/AllCharacterAnimationsDoctorDark");
            NurseTexture = Content.Load<Texture2D>("Animations/AllCharacterAnimationsHoitsu");
            NurseTextureDark = Content.Load<Texture2D>("Animations/AllCharacterAnimationsHoitsuDark");

            WorldTileSheet = Content.Load<Texture2D>("Maps/worldsheet");
            WorldTileSheetDark = Content.Load<Texture2D>("Maps/hellworldsheet");
            PropsTileSheet = Content.Load<Texture2D>("Maps/props");
            PropsTileSheetDark = Content.Load<Texture2D>("Maps/hellprops");

            Menu = Content.Load<Texture2D>("titlescreenhearthand2");
            Credits = Content.Load<Texture2D>("Credits1");

            Start1 = Content.Load<Texture2D>("StartImages/start1");
            Start2 = Content.Load<Texture2D>("StartImages/start2");
            Start3 = Content.Load<Texture2D>("StartImages/start3");
            Start4 = Content.Load<Texture2D>("StartImages/start4");

            End1 = Content.Load<Texture2D>("StartImages/End1");
            End2 = Content.Load<Texture2D>("StartImages/End2");
            End3 = Content.Load<Texture2D>("StartImages/End3");

            MenuMusic = Content.Load<SoundEffect>("Music/1 musa v1");
            Musa1 = Content.Load<SoundEffect>("Music/1_musiikki");
            Musa2 = Content.Load<SoundEffect>("Music/2_musiikki");
            Musa3 = Content.Load<SoundEffect>("Music/3_musiikki");
            Musa4 = Content.Load<SoundEffect>("Music/4_musiikki");
            kirkuna = Content.Load<SoundEffect>("Music/kirkuna");

            instance = MenuMusic.CreateInstance();
            instance.IsLooped = true;
            instance.Volume = volume;
            instance.Play();

            player = new Player(PlayerTexture, new Vector2(55));

            enemies = new List<Enemy> ();

            Map.InitObjectDrawing(GraphicsDevice);
            map = Content.Load<Map>("Maps/Stage");
            mapView = map.Bounds;
            hitbox = new Hitbox(map);
            heartbeat = Content.Load<SoundEffect>("GGJ13_Theme");
            heartbeatInstance = heartbeat.CreateInstance();

            // TODO: use this.Content to load your game content here
        }