Changeset 58


Ignore:
Timestamp:
02/21/2012 01:23:51 PM (3 years ago)
Author:
acarter
Message:

Match game always clears

Location:
Code/oMaE/oMaE
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Code/oMaE/oMaE/GameDriver.cs

    r57 r58  
    192192        public void EndSequence()
    193193        {
    194             World3D.Visible = true;
     194            Play2DGame(Map.Entrance.DoorLock, new Vector2(0, 0));
     195            // FIXME
     196            Map.Entrance.DoorLock.Back.Visible = false;
    195197        }
    196198
     
    290292        public GameObject CompleteMinigame(GameObject game)
    291293        {
     294            // FIXME
     295            Map.Entrance.DoorLock.Back.Visible = true;
    292296            game.Visible = false;
    293297            World3D.Visible = true;
  • Code/oMaE/oMaE/MiniGames/Match.cs

    r44 r58  
    2424        int[] offset = new int[]{22, 17, 0, 25, 38};
    2525        String[] energies = new String[] { "Kinetic Energy", "Electric Energy", "Chemical Energy", "Sound Energy", "Light Energy", "Thermal Energy", "Wind Energy" };
    26 
     26        Dictionary<Vector4, bool> lines = new Dictionary<Vector4, bool>();
    2727        /// <summary>
    2828        /// Initializes the match minigame.
     
    3434            for (int i = 0; i < 2; ++i)
    3535                for (int j = 0; j < energies.Length; ++j)
    36                     radioGroup.addRadioButton(new Vector2(i == 0 ? 165 : 590, 40 * j + 106), energies[j], i == 0 ? TextLocation.LEFT : TextLocation.RIGHT);
     36                    radioGroup.addRadioButton(new Vector2(i == 0 ? 170 : 470, 40 * j + 120), energies[j], i == 0 ? TextLocation.LEFT : TextLocation.RIGHT);
    3737            matchGroup = new RadioGroup();
    3838            children.Add(matchGroup);
    39             children.Add(new MatchImage(matchGroup, new Image2D("Sprites/drum", new Rectangle(310, 20, 100, 100))));
    40             children.Add(new MatchImage(matchGroup, new Image2D("Sprites/microphone", new Rectangle(325, 170, 50, 100))));
    41             children.Add(new MatchImage(matchGroup, new Image2D("Sprites/speaker", new Rectangle(300, 320, 100, 100))));
     39            children.Add(new MatchImage(matchGroup, new Image2D("Sprites/drum", new Rectangle(270, 70, 100, 100))));
     40            children.Add(new MatchImage(matchGroup, new Image2D("Sprites/microphone", new Rectangle(295, 190, 50, 100))));
     41            children.Add(new MatchImage(matchGroup, new Image2D("Sprites/speaker", new Rectangle(270, 310, 100, 100))));
    4242            base.Initialize();
     43        }
     44        public override void Update()
     45        {
     46            if (radioGroup.ActiveButton != null && matchGroup.ActiveButton != null)
     47            {
     48                Vector4 line = new Vector4(radioGroup.ActiveButton.Center.X,
     49                                           radioGroup.ActiveButton.Center.Y,
     50                                           matchGroup.ActiveButton.Center.X,
     51                                           matchGroup.ActiveButton.Center.Y);
     52                if (!lines.ContainsKey(line))
     53                    lines.Add(line, true);
     54                else
     55                    lines[line] = !lines[line];
     56                radioGroup.ClearActive();
     57                matchGroup.ClearActive();
     58            }
     59            base.Update();
    4360        }
    4461        /// <summary>
     
    5168            if (radioGroup.ActiveButton != null)
    5269                screen.DrawLine(radioGroup.ActiveButton.Center, gameState.MousePos, Color.Black);
     70            if (matchGroup.ActiveButton != null)
     71                screen.DrawLine(matchGroup.ActiveButton.Center, gameState.MousePos, Color.Black);
     72            foreach (KeyValuePair<Vector4, bool> pair in lines)
     73                if (pair.Value)
     74                    screen.DrawLine(new Vector2(pair.Key.X, pair.Key.Y), new Vector2(pair.Key.Z, pair.Key.W), Color.White);
     75            screen.DrawText("Match the images to the forms of energy that they convert", new Vector2(320, 10), TextHorizontal.CENTERED, TextVertical.TOP, Color.White);
     76            screen.DrawText("Starts as", new Vector2(220, 60), TextHorizontal.CENTERED, TextVertical.TOP, Color.White);
     77            screen.DrawText("and becomes", new Vector2(420, 60), TextHorizontal.CENTERED, TextVertical.TOP, Color.White);
    5378            base.Draw(screen, gameState);
    5479        }
  • Code/oMaE/oMaE/Overworld/Display3D.cs

    r57 r58  
    1919    public class Display3D : GameObject
    2020    {
    21         private static long ARROW_TEXT_LENGTH = 5000;
     21        private static long ARROW_TEXT_LENGTH = 3000;
    2222        /// <summary>
    2323        /// A list of all walls on the map
     
    7575            you.reset(0, 6, 0);
    7676        }
     77        /// <summary>
     78        /// Sets the current location of the camera.
     79        /// </summary>
     80        /// <param name="loc">Your location.</param>
    7781        public void SetLocation(Vector2 loc)
    7882        {
  • Code/oMaE/oMaE/Overworld/Map.cs

    r57 r58  
    4040        private string[] map;
    4141        private int[][] minimap;
     42        public Door Entrance;
    4243        private Vector2 start = Vector2.Zero;
    4344        /// <summary>
     
    173174                            doors.AddFirst(partner = new Door(Color.Black, Color.Black, Color.LightSlateGray, left, right, 30, 40, ""));
    174175                            doors.AddFirst(new Door(Color.Black, Color.Black, Color.LightSlateGray, right, left, partner, 30, 40, ""));
     176                            Entrance = partner;
    175177                            break;
    176178                        case 'I':
     
    215217                            walls.AddFirst(new Wall(Color.LightSlateGray, right, left, 40f));
    216218                            break;
    217                             break;
    218219                        case 'r':
    219220                            walls.AddFirst(new Wall(Color.LightSlateGray, bottom, center, 40f));
  • Code/oMaE/oMaE/Overworld/Objects/Door.cs

    r57 r58  
    2020    {
    2121        private Vector2 otherSide;
    22         private MiniGame doorLock;
     22        public MiniGame DoorLock;
    2323        private Tile door, wall;
    2424        private bool elephantNear;
     
    7979            children.Add(wall);
    8080            // FIXME
    81             if (partner == null || partner.doorLock == null)
    82                 doorLock = driver.GetMinigame();
     81            if (partner == null || partner.DoorLock == null)
     82                DoorLock = driver.GetMinigame();
    8383            else
    84                 doorLock = partner.doorLock;
     84                DoorLock = partner.DoorLock;
    8585            base.Initialize();
    8686        }
     
    116116        {
    117117            if (elephantNear && gameState.Down(Keys.Space))
    118                 driver.Play2DGame(doorLock, otherSide);
    119             if (doorLock.Completed)
     118                driver.Play2DGame(DoorLock, otherSide);
     119            if (DoorLock.Completed)
    120120                door.Color = completed;
    121121            base.Update(gameState);
  • Code/oMaE/oMaE/Widgets/RadioButton.cs

    r40 r58  
    9191        /// Clears the radio button.
    9292        /// </summary>
    93         public void clear()
     93        public void Clear()
    9494        {
    9595            Updated |= Active;
  • Code/oMaE/oMaE/Widgets/RadioGroup.cs

    r42 r58  
    4949        }
    5050
     51        public void ClearActive()
     52        {
     53            ActiveButton.Clear();
     54            ActiveButton = null;
     55        }
    5156        /// <summary>
    5257        /// A radio button has been updated.
     
    6166            else
    6267            {
    63                 ActiveButton.clear();
     68                ActiveButton.Clear();
    6469                ActiveButton = radioButton;
    6570            }
Note: See TracChangeset for help on using the changeset viewer.