Beispiel #1
0
        public void Update(Player player)
        {
            // Creates a rectangle that surounds the lower part of the NPC
            NpcRectangle = new Rectangle((int)Position.X - Texture.Width, (int)Position.Y - Texture.Height / 4, Texture.Width * 2, Texture.Height);

            // Checks if Player collides with the NPC
            if (NpcRectangle.Contains((int)player.Position.X, (int)player.Position.Y))
            {
                IsDialogActive = true;
            }
            else
                IsDialogActive = false;
        }
Beispiel #2
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Load sprite font
            MenuFont = Content.Load<SpriteFont>("MenuFont");
            MenuTitleFont = Content.Load<SpriteFont>("MenuTitleFont");
            SpriteFont DialogFont = Content.Load<SpriteFont>("DialogFont");

            // Load MenuBackground
            MenuBackground = Content.Load<Texture2D>("MenuBackground");

            // Load sound effects
            HelloKittyTheme = Content.Load<SoundEffect>("HelloKittyTheme");
            HellMarch = Content.Load<SoundEffect>("HellMarch");

            // Initialize the different levels used
            Island1 = new Level(Content.Load<Texture2D>("bg1"), Content.Load<Texture2D>("bg1_collision"), new Vector2(1200, 370), 1);
            Island1House = new Level(Content.Load<Texture2D>("mamahouse"), Content.Load<Texture2D>("mamahouse_collision"), new Vector2(590, 500), 3);

            Island2 = new Level(Content.Load<Texture2D>("bg2"), Content.Load<Texture2D>("bg2_collision"), new Vector2(50, 330), 2);
            Island2House = new Level(Content.Load<Texture2D>("papahouse"), Content.Load<Texture2D>("papahouse_collision"), new Vector2(550, 500), 3);

            Island3 = new Level(Content.Load<Texture2D>("bg3"), Content.Load<Texture2D>("bg3_collision"), new Vector2(378, 150), 0);
            Island3House = new Level(Content.Load<Texture2D>("mimmihouse"), Content.Load<Texture2D>("mimmihouse_collision"), new Vector2(575, 530), 3);

            ActiveLevel = Island1;

            // Load the sprite and player
            Sprite playerSprite = new Sprite(Content.Load<Texture2D>("charsheet"), 58, 73, 1f);

            Player = new Player(playerSprite);

            // Load the NPCs
            Mama = new Npc(Content.Load<Texture2D>("Mama"), new Vector2(590, 225));
            Papa = new Npc(Content.Load<Texture2D>("Papa"), new Vector2(400, 230));
            Mimmy = new Npc(Content.Load<Texture2D>("Mimmy"), new Vector2(420, 260));

            // DialogTexture
            Texture2D DialogBoxTexture = Content.Load<Texture2D>("blank");

            // Give NPCs Dialog text
            Mama.Dialog(DialogBoxTexture, DialogFont, "I dont know where Mimmy is, cross the bridge and ask Papa.", new Vector2(570, 65));
            Papa.Dialog(DialogBoxTexture, DialogFont, "Mimmy is in the house south of Mama.", new Vector2(380, 70));
            Mimmy.Dialog(DialogBoxTexture, DialogFont, "I am your Mimmy!", new Vector2(400, 110));
        }