• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

how to go to specific room with transition

jermaine

Member
so i watched this video a while ago and its a tutorial for transition between rooms.
but right now i can only go to the next,previous room or restart or just end the game.depending on the room order.
i wanna make it so that i can go to each room while ignoring the room order.
the video is here.
i did try making a new scipt. i wanted to use it like this.
so like since there was a state machine. i tried making a new state that would need me to put in which room i wanna go to,depending on the situation.
but first of all.ive never used scripts before.im not so sure how they work.ive only used them while following tutorials. even then im not so sure what im doing.
so how should i do this?
 

TheouAegis

Member
If you want to ignore room order, use room_goto() and pass the ID of the room you want to go to in the argument for room_goto().
 

jermaine

Member
yea but for different situations i wanna go to diff rooms
and i dont really think its a good idea to create so many "modes"

so is there a way...mayb scripts to create it so that i can make it go to a choose the room in the objects code instead of another "mode"
i hope i made it understandable
 

TheouAegis

Member
I'm not quite following. Are you essentially asking how to do Legend of Zelda room changes? Where walking up sends you to the room above, walking right sends you to the room to the right, walking down sends you to the room below, and walking left into the room to the left? Other than wise, I don't understand what you mean by "modes".
 

jermaine

Member
well...now im not quite following...
ok assuming u didnt watch the video or didnt understand. imma try and explain it again. do tell me where u don understand.

so basically this object draws like two rectangle on top and bottom of the screen to make it look like its closing and when it opens its another room.now im using enum for a finite state system(not mode sorry i meant state).and in every one of these states.its just going into so called drawing state where it draws the rectangle. and one more line after it which write either "room_goto(...)" or something like "game_restart()". but i wanna create one state that works for all scenarios.
not to mention. the video shows to use a script that creates like a function...(im not really used to scripts yet)
and it says that in argument 0 i would have to state the state i want the transition to be in,basically saying where i wanna go.
theres another argument which im not sure what for which is if (argument_count > 1) target = argument[1]
and "target" is set as just "room" but when i actually use this i don have to type in the second argument so im not sure what it actually does.
right now if i wanna use the transition. i would use code in another object for something like...
"trans(trans_mode.next)" something like that.

and so im trying to make one state that can basically make me go anywhere i want.
something like....i could input the room name only when i want to actually use it and not setting dozens of states.
i hope this all makes sense. please tell me if u dont understand any parts so that i can try to make it clearer.

EDIT: after giving it some thought. yea ig it is kinda like zelda yea.
 
Last edited:

Gamebot

Member
I think a script would be your best bet and simply have one input such as a number when "something happens". "Argument [n]" are no longer available in 2.3+. The good thing is you can replace those arguments with anything you want and will automatically be used as such. Would something simple like this work?

Code:
function roomnext(input) {
 
    switch(input){
    case 0: room_goto_next( room_1 ); break;
    case 1: room_goto_next( room_2 ); break;
    case 2: room_goto_next( room_3 ); break;
    case 3: room_goto_next( room_4 ); break;
    .
    .
    default: room_goto_next( room_gameend ); break;
    }
}
EDIT: Just so your aware whatever your inputs are they need to match the input after the case statement and before the colon.
 

jermaine

Member
wait "argument[n]" isnt here anymore? im using 2.3.1 and it still works
"Argument [n]" are no longer available in 2.3+
hold on....like i said im not really good with scripts.
so do i need to like...so called prepare any other extra variables in the create event for the transition object in order for this to work.
and how exactly will i acitivate it.
like do i just go to any obeject and just do "roomnext(case number)"???
 
Top