Windows Help with Rooms

Discussion in 'Programming' started by talinroyal23, Aug 14, 2019.

  1. talinroyal23

    talinroyal23 Member

    Joined:
    Aug 14, 2019
    Posts:
    2
    Alright, so, in my game, there is various options you can choose that take you to different rooms. One of them is called "Go Back" and I want it to take you to the last room you were in before it. I'm having trouble coding it and other videos/threads I've found, don't correlate with my problem. Any advice or help is welcome, thanks!
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,317
    Save the current room in a global variable before changing to the other room:
    Code:
    global.room_back = room;
    room_goto(rm_somewhere_else);
    
    Then you can just use that global variable to go back:
    Code:
    room_goto(global.room_back);
     
  3. talinroyal23

    talinroyal23 Member

    Joined:
    Aug 14, 2019
    Posts:
    2
    Yes, but there will be multiple rooms where "Go Back" is an option, and I do not want it sending me to the same room. Will I have to create seperate objects for each of them?
     
  4. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,317
    You use the first piece whenever you go to a room where "Go Back" is an option (replacing rm_somewhere_else with that room), and the second piece when you select "Go Back". I don't see how you would arrive at the conclusion you did.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice