• 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!

Legacy GM question about random pick of room when game starts

E

EZTALES

Guest
hey yall,
quick question about if this is possible in GM1.4 and if it could maybe someone give me an idea how to do it. any help is greatly appreciated!
so what i have is 4 rooms all called:
rm_menu
rm_menu2
rm_menu3
rm_menu4
(btw cant use backgrounds because i need sprites in my rooms.)
what i want is when the game starts up it randomly chooses between 1 of these 4 rooms.
thanks!
 
Create a room before those 4 rooms so it load first.

In the creation code for that room, use the choose () function to pick a room and go to it using room_goto()
 
E

EZTALES

Guest
okay
Create a room before those 4 rooms so it load first.

In the creation code for that room, use the choose () function to pick a room and go to it using room_goto()
okay this does load up but sadly it keeps going to one room everytime i load the game
this is my code, sorry if this is not so good, im still understanding the langauge,
create event:

room_goto (choose(rm_menu,rm_menu1,rm_menu3))
 
T

ThePropagation

Guest
Every game I make I make an rmInitialize as the very first room in the project/game. Make objInitialize and put Babia's code into it, put the object in the initialize room and you've got your solution

type

randomize();
room_goto(choose(rm1, rm2, rm3, rm4));
 
E

EZTALES

Guest
Every game I make I make an rmInitialize as the very first room in the project/game. Make objInitialize and put Babia's code into it, put the object in the initialize room and you've got your solution

type

randomize();
room_goto(choose(rm1, rm2, rm3, rm4));
worked! thanks!
 
D

Danei

Guest
By the way, the manual entry for the choose() function notes that you need to use randomize() during testing. It's a good idea to read through the manual entry for every function you're using, especially when your code isn't doing what you expect. You can middle click a function to bring up its manual page without having to type it in.
 

JasonTomLee

Member
By the way, the manual entry for the choose() function notes that you need to use randomize() during testing. It's a good idea to read through the manual entry for every function you're using, especially when your code isn't doing what you expect. You can middle click a function to bring up its manual page without having to type it in.
Note that you can save and set random seeds if you'd like to save or change the 'randomness' of your game
 
E

EZTALES

Guest
By the way, the manual entry for the choose() function notes that you need to use randomize() during testing. It's a good idea to read through the manual entry for every function you're using, especially when your code isn't doing what you expect. You can middle click a function to bring up its manual page without having to type it in.
oh! didnteven know about that! thanks!
 
Top