Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2009
    Posts
    39

    hyperion project adding Goggles

    Hey all, im trying to add goggles to my hyperion project that enable you to see what direction your going in when in "dark rooms". The idea is alittle crazy and im completely new to programming. Any help would be nice.

    below is the code for 1 room, this is not the actual game code

    Code:
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //create the red room
                room = new Room();
    
                //Assign this room to location 0, 0
                rooms[0, 0] = room;
    
                //setup room properties 
                room.Title = "Red Room";
                room.Description = "You have entered the Red room. There is a locked door to the South";
                room.AddExits(Direction.East);
                
                //create new item
                item = new Item();
    
                //setup the item
                item.Title = "goggles";
                item.PickupText = ("you just picked up the goggles.");
    Last edited by neelz; 07-25-2009 at 03:36 AM.

  2. #2
    Join Date
    Dec 2006
    Posts
    16

    how

    how would i go about programming an item called "goggles", to when picked up, allow the player to see possible directions. ? n/s/e/w etc etc. look at the other items, there very basic.

  3. #3
    Join Date
    Feb 2002
    Location
    Belgium, Limburg
    Posts
    7,196
    What you can do, is make the GameManager class check if the player has the goggles in their inventory.

    Code:
            public static void ApplyRules()
            {
                if (Player.GetInventoryItem("goggles") != null)
                {
                    Level.Rooms[0, 0].AddExits(Direction.North);
                    Level.Rooms[0, 0].Description = "You have entered the Red Room. There's a locked door to the south. \n\n *** With the goggles on, you see a secret door to the north!";
                }
            }
    So anytime the player has the goggles in their inventory and they're in room 0,0, there's an exit to the north. If you want to have other exits in other rooms when the player has the goggles, you just add them here.
    Technical Artist at LuGus Studios
    www.lugus-studios.be


    nielsVaes.be


  4. #4
    Join Date
    Mar 2003
    Location
    Denmark
    Posts
    2,882
    Exactly. You need to do a check if the player has goggles in inventory, and if so act upon it. Wont give up more answer atm
    Swoop - Buzzed Pirate!
    " If nobodys talking to me, im talking to me" - Swoop

    Reflection Design || Swoops Blog

    2D Tutorials Compilation

    The Speed Painting Thread || ((post your Concept Art thread))


  5. #5
    Join Date
    Dec 2006
    Posts
    16
    thanks man

  6. #6
    Join Date
    Dec 2006
    Posts
    16
    hold up lol, it only works for the first room. like when i start it says "possible directions" none, then i pick up an item, it doesnt have to be the goggles and the direction east pops up. i also cant get the goggles to display a direction even though ive followed the previous posts. Im a new programmer, any help would be nice.

  7. #7
    Join Date
    Feb 2002
    Location
    Belgium, Limburg
    Posts
    7,196
    Can you post the code from your GameManager class?
    Technical Artist at LuGus Studios
    www.lugus-studios.be


    nielsVaes.be


  8. #8
    Join Date
    Jul 2009
    Posts
    39
    {
    if (Player.GetInventoryItem("goggles") == null)
    {
    Console.ForegroundColor = ConsoleColor.White;

    }
    else
    {
    Console.ForegroundColor = ConsoleColor.Green;

    }

    Level.Rooms[0, 0].AddExits(Direction.East);
    Level.Rooms[0, 0].Description = "You have entered the camp, before you is a dark cave. \n\n.";


    {






    }
    }











    if (Level.Rooms[0, 0].GetItem("Red Ball") != null &&
    Level.Rooms[1, 0].GetItem("Blue Ball") != null &&
    Level.Rooms[1, 1].GetItem("Yellow Ball") != null &&
    Level.Rooms[0, 1].GetItem("Green Ball") != null)
    {
    EndGame("Good Job! You win!");
    }
    if (Player.GetInventoryItem("key") != null)
    {
    Level.Rooms[0, 0].AddExit(Direction.South); //red room
    Level.Rooms[0, 0].Description = "you have entered the red room.";

    Level.Rooms[0, 1].AddExit(Direction.South); //red room
    Level.Rooms[0, 1].Description = "you have entered the green room.";
    }

    if (Player.GetInventoryItem("Key") != null)
    {
    Level.Rooms[0, 0].AddExit(Direction.South); //red room
    Level.Rooms[0, 0].Description = " You have entered the Red room.";

    Level.Rooms[0, 1].AddExit(Direction.North); //green room
    Level.Rooms[0, 0].Description = " You have entered the Green room.";
    }

    if (Player.Moves > 10)
    {
    EndGame("you are old and slow. Game Over.");
    }


    }

    public static void ApplyRules1()
    {
    if (Player.GetInventoryItem("goggles") != null)
    {
    Level.Rooms[0, 0].AddExits(Direction.South);
    Level.Rooms[0, 0].Description = "You have entered the Red Room. There's a locked door to the south. \n\n *** With the goggles on, you see a secret door to the north!";
    }
    }


    }
    }

  9. #9
    Join Date
    Mar 2008
    Posts
    10
    Code:
    // What happens above?
    {
          if (Player.GetInventoryItem("goggles") == null)
          {
                Console.ForegroundColor = ConsoleColor.White;
                // If you have the goggles the color is white.
          }
          else
          {
                Console.ForegroundColor = ConsoleColor.Green;
                // If you don't have the goggles the color is green.
          } 
           // The goggle check ends here
    
    Level.Rooms[0, 0].AddExits(Direction.East);
    Level.Rooms[0, 0].Description = "You have entered the camp, before you is a dark cave. \n\n.";
    // This is not inside the check so it will add this whether you have the goggles or not
    
    {
    }
    }
    I commented it a bit, hope I can help you. Just finished the tutorial myself.
    Code:
    public static void ApplyRules1()
    {
    if (Player.GetInventoryItem("goggles") != null)
    {
    Level.Rooms[0, 0].AddExits(Direction.South);
    Level.Rooms[0, 0].Description = "You have entered the Red Room. There's a locked door to the south. \n\n *** With the goggles on, you see a secret door to the north!";
    }
    }
    This code look alright, not sure why you have an "ApplyRules1".
    The reason why it only works in the first room is because it's
    "Level.Rooms[0, 0]"
    This means that the posX, PosY is [0, 0]. You have to change these to enable your rules in another room.

    Hope it helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •