1. Hey! Guest! The 31st GMC Jam will take place between Nov 16th, 12:00 UTC (Friday noon) and Nov 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

not changing rooms?

Discussion in 'Programming' started by corwin22, Jun 13, 2018.

Tags:
  1. corwin22

    corwin22 Member

    Joined:
    Nov 18, 2017
    Posts:
    69
    I have a code that uses a variable to determine what room it will take you to but it just puts you back in the same room?
    Code:
    rm = "rm_door" + string(symbol)
    if ((place_meeting(x,y+64,obj_player)) && keyboard_check(vk_space)) {
    room_goto(rm)   
    }
    
    the room's name is rm_door1 and symbol = 1
    when i draw "rm" is shows "rm_door1" so i am confused why it doesn't move me to the right room.
     
  2. Humayun

    Humayun Member

    Joined:
    Jun 20, 2016
    Posts:
    89
    room_goto() function requires room index not its name in string. Take a look asset_get_index() function if you don't want to change your code. So finally you'll have something like
    Code:
    room_goto(asset_get_index(rm))
     
  3. corwin22

    corwin22 Member

    Joined:
    Nov 18, 2017
    Posts:
    69
    Thank you it works now
     

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