Click here to Skip to main content
15,891,204 members
Articles / Multimedia / GDI+

Dungeon of Despair: A scripted demo game using Conscript

Rate me:
Please Sign up or sign in to vote.
4.96/5 (54 votes)
5 Sep 2008CPOL8 min read 92K   1.9K   103  
This article presents a demo script-driven game using Conscript, a scripting engine presented in an earlier article
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace DungeonOfDespair
{
    public class Doors
    {
        private static Image s_imageNorth = Properties.Resources.DoorNorth;
        private static Image s_imageSouth = Properties.Resources.DoorSouth;
        private static Image s_imageWest = Properties.Resources.DoorWest;
        private static Image s_imageEast = Properties.Resources.DoorEast;

        private String m_strNorth;
        private String m_strSouth;
        private String m_strWest;
        private String m_strEast;

        public Doors()
        {
            m_strNorth = null;
            m_strSouth = null;
            m_strWest = null;
            m_strEast = null;
        }

        public void Draw(Graphics graphics)
        {
            if (m_strNorth != null)
                graphics.DrawImage(s_imageNorth,
                    258, 6,
                    s_imageNorth.Width, s_imageNorth.Height);

            if (m_strSouth != null)
                graphics.DrawImage(s_imageSouth,
                    258, 369,
                    s_imageSouth.Width, s_imageSouth.Height);

            if (m_strWest != null)
                graphics.DrawImage(s_imageWest,
                    2, 173,
                    s_imageWest.Width, s_imageWest.Height);

            if (m_strEast != null)
                graphics.DrawImage(s_imageEast,
                    533, 173,
                    s_imageEast.Width, s_imageEast.Height);
        }

        public String North
        {
            get { return m_strNorth; }
            set { m_strNorth = value; }
        }

        public String South
        {
            get { return m_strSouth; }
            set { m_strSouth = value; }
        }

        public String West
        {
            get { return m_strWest; }
            set { m_strWest = value; }
        }

        public String East
        {
            get { return m_strEast; }
            set { m_strEast = value; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Malta Malta
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions