示例#1
0
        public Player()
            : base()
        {
            dictionary = new ArrayList();

            dictionary.Add("cat");
            dictionary.Add("dog");
            dictionary.Add("ball");
            dictionary.Add("boo");
            dictionary.Add("house");

            text = new RichText("", 64);
            text.X = 50;
            text.Y = 50;
            text.Color = Color.White;
        }
示例#2
0
 public MainMenu() : base()
 {
     RichText mainT = new RichText("STAR WARS",Global.sText,28);
     mainT.Color = Color.Yellow;
     RichText ptp = new RichText("PRESS SPACE TO PLAY",Global.sText,28,28);
     ptp.Color = Color.Yellow;
     AddGraphic(mainT, 250, 150);
     AddGraphic(ptp, 185, 350);
     
     for(int i = 0;i < 1000;i++)
     {
         int x = Rand.Int(800);
         int y = Rand.Int(600);
         Image star = Image.CreateCircle(1, Color.White);
         AddGraphic(star,x,y);
     }
 }
示例#3
0
 public aEndScene() : base()
 {
     for (int i = 0; i < 1000; i++)
     {
         int x = Rand.Int(800);
         int y = Rand.Int(600);
         Image star = Image.CreateCircle(1, Color.White);
         AddGraphic(star, x, y);
     }
    
     RichText t = new RichText("anakin wins!",Global.sText,28,28);
     RichText ptp = new RichText("press space to play", Global.sText, 28, 28);
     ptp.Color = Color.Yellow;
     t.Color = Color.Yellow;
     aWin.Play();
     AddGraphic(ptp, 135, 350);
     AddGraphic(t, 195, 200);
 }
示例#4
0
        public Textbox(float ScrX, float ScrY, float Width, float Height, int MaxLength, bool GradualAppear, Font NewFont)
        {
            X = ScrX;
            Y = ScrY;
            BoxWidth = Width;
            BoxHeight = Height;
            MaxTextLength = MaxLength;
            TextGraduallyAppears = GradualAppear;
            ChosenFont = NewFont;

            // Create Box Graphic at the right size :D
            Graphic = Image.CreateRectangle((int)Width, (int)Height, Color.Black);
            Graphic.Scroll = 0;

            // Create RichText
            Text = new RichText("");

            // Add borders & corners
        }
示例#5
0
        public House(float x, float y)
            : base()
        {
            img = new Image(Resources.HouseSprite);

            SetGraphic(img);

            img.CenterOrigin();

            this.X = x;
            this.Y = y;

            img.Scale = 1;
            img.Visible = true;

            text = new RichText("house", 64);
            text.X = Game.Instance.HalfWidth - img.HalfWidth / 2;
            text.Y = img.Height + 150;
            text.Color = Color.Red;
        }
示例#6
0
        // we need text-reveal mode or sth. edit richtext?
        public PlayState()
        {
            //Load shader
            VHSShader = new Shader(ShaderType.Fragment, Assets.VHS_SHADER);
            VHSShader2 = new Shader(ShaderType.Fragment, Assets.VHS_SHADER2);
            Global.theGame.Surface.AddShader(VHSShader);
            Global.theGame.Surface.AddShader(VHSShader2);

            // Create starfield.
            starFieldFar = new Image(Assets.GFX_STARFIELD);
            starFieldFar.Repeat = true;
            starFieldFar.Scroll = 0.3f;
            starFieldMid = new Image(Assets.GFX_STARFIELD);
            starFieldMid.Repeat = true;
            starFieldMid.Scroll = 0.6f;
            starFieldMid.Scale = 1.5f;
            starFieldClose = new Image(Assets.GFX_STARFIELD);
            starFieldClose.Repeat = true;
            starFieldClose.Scroll = 1.3f;
            starFieldClose.Scale = 3.0f;
            starFieldClose.Alpha = 0.5f;

            AddGraphic(starFieldFar);
            AddGraphic(starFieldMid);
            AddGraphic(starFieldClose);

            // Load map
            floorTiles = mapProject.CreateTilemap((TiledTileLayer)mapProject.Layers[0]);
            wallTiles = mapProject.CreateTilemap((TiledTileLayer)mapProject.Layers[1], mapProject.TileSets[1]);

            // Make sure walls have the correct tiles
            wallCollision = mapProject.CreateGridCollider((TiledTileLayer)mapProject.Layers[1], 3);
            floorCollision = mapProject.CreateGridCollider((TiledTileLayer)mapProject.Layers[0], 8);

            // Move camera to start point
            TiledObjectGroup mapObjects = (TiledObjectGroup)mapProject.Layers[2];
            TiledObject strt = mapObjects.Objects[0];

            // Make machines

            CameraX = strt.X - 320;
            CameraY = strt.Y - 240;

            // Add player
            thePlayer = new Player(strt.X, strt.Y);
            thePlayer.Layer = 20;

            // Add station & player to scene

            AddGraphic(floorTiles);
            Add(thePlayer);

            // Make items / machines
            for (int i = 0; i < mapObjects.Objects.Count; i++)
            {
                TiledObject curObj = mapObjects.Objects[i];
                if (curObj.Name == "Wrench")
                {
                    Item newWrench = new Item(curObj.X, curObj.Y, 4);
                    Add(newWrench);
                }
                if (curObj.Name == "Crisps")
                {
                    Item newWrench = new Item(curObj.X, curObj.Y, 7);
                    Add(newWrench);
                }
                if (curObj.Name == "Donut")
                {
                    Item newWrench = new Item(curObj.X, curObj.Y, 6);
                    Add(newWrench);
                }
                if (curObj.Name == "VendingMachine")
                {
                    Machine newMachine = new Machine(curObj.X, curObj.Y, "Vending Machine", "Full of delicious snacks.", "Looks like it's busted.", "It's rebooting.", 300, Assets.GFX_MACHINETOP, Assets.GFX_VENDING);
                    Add(newMachine);
                }
                if (curObj.Name == "Computer")
                {
                    Machine newMachine = new Machine(curObj.X, curObj.Y, "Computer", "The communications terminal... me.", "ERROR: HHHH\nhelp\n \n{color:ff0000}ERRCODE#391293EFF3{color:ffffff}", "It was just a screensaver.\nYou idiot.", 600, Assets.GFX_PC_TOP, Assets.GFX_PC_FRONT);
                    Add(newMachine);
                }
                if (curObj.Type == "AirlockVert")
                {
                    Airlock newAirlock = new Airlock(curObj.X, curObj.Y, true);
                    Add(newAirlock);

                }
                if (curObj.Type == "AirlockHoriz")
                {
                    Airlock newAirlock = new Airlock(curObj.X, curObj.Y, false);
                    Add(newAirlock);

                }
            }

            AddGraphic(wallTiles);
            Add(thePlayer.crossHair);

            wallTest = new Entity(0, 0, null, wallCollision);
            Add(wallTest);
            floorTest = new Entity(0, 0, null, floorCollision);
            Add(floorTest);

            // Add hud
            msgBox = new Image(Assets.GFX_HUD);
            msgBox.Scroll = 0;
            msgBox.CenterOrigin();
            msgBox.X = 320;
            msgBox.Y = 255 + msgBox.Height + 16;
            Entity hud1 = new Entity();

            hud1.AddGraphic(msgBox);
            hud1.Layer = 10;
            Add(hud1);

            msgText = new RichText("", Assets.FONT_MSG, 8, 270, 50);
            msgText.DefaultShakeX = 0.4f;
            msgText.DefaultShakeY = 0.4f;
            msgText.X = 325 - msgBox.HalfWidth;
            msgText.Y = 255 + msgBox.Height - 8;
            msgText.Scroll = 0;
            msgText.String = "";
            Entity hud2 = new Entity();

            hud2.AddGraphic(msgText);
            hud2.Layer = 5;
            Add(hud2);
        }