but it's worth a try. I'm working on something, a project in school. Anyone heard of Game Maker? It has its own programming language and I need help, I can't make it do what I want it to do...
What I'm trying to do is set a variable to a random number, and then test that number and if it equals a certain thing, have it go to a different room.
round(random(2)) Will generate a random number, I'm not sure how to assign it to a variable
room_goto(mg_00x) Will go to the room i specify. God this'd be so much more easier if they just put in a function for go to random room...
Results 1 to 5 of 5
- 01 Dec. 2009 05:01pm #1
Probably not gonna get much here....
Last edited by gotxbrain; 01 Dec. 2009 at 05:04pm.
- 01 Dec. 2009 06:42pm #2
Is game maker by yo yo games?
YoYo Games | Game Maker
- 01 Dec. 2009 06:43pm #3
Heh. I haven't seen Game Maker in ages. I can't imagine how much it's changed over the years.
Generally, to assign a variable, you do:
variable_name = value
So
random_number = round(random(2))
Not sure if this is how Game Maker does it specifically, but there you go.
Also, you don't have to assign it to a variable if it's used only once.
if (round(random(2)) == 1) { /* do random action */ }
This isn't Game Maker code specifically, I don't think, but it's how most programming languages go about doing such things, so it will be silly is Game Maker strayed too far from these codes.
- 01 Dec. 2009 06:51pm #4
- 02 Dec. 2009 12:50am #5
- Age
- 30
- Join Date
- Nov. 2009
- Location
- Anaheim, California
- Posts
- 1,065
- Reputation
- 99
- LCash
- 200.00
Yeah, as proper coding technique always verify that the "room" in question exists and that it is possible to load it at that state in time.
More beginner game creators forget this step and end in some major glitches, not saying that you do not know what you're doing just trying to give a word of wisdom
It is always important to make sure data is set before attempting to use it.
You do not want any pesky memory leaks