Large Error with my rooms
#1
Posted 01 June 2012 - 10:14 AM
I have a rather large problem . I'm making a game called 'Driver'. Before I begin you should note that I have the following rooms;
Title Screen
Level 1
Level 2 (which has nothing on it)
Pause Menu
'Are you sure you want to quit' menu
When I test the game it loads up to the title screen and I click on the 'Start Game' button on the screen. Usally it would goto Level 1. Instead it goes to the empty level 2. Now I quit and decide to see whether this is a super bug or if it is going to room 2. So I put an object in room 2 so I can figure out what is happening. I re-test the game. It ges to the title screen and I click 'Start game'. There is a quick flash, which I belive is the two other rooms being quickly jumped over. It then ends up on the pause screen. I have tried re-coding the rooms (They are all linked with the room_goto code) but the same thing continues to happen. Any Help with this?
Extra Info:
The scoring changes the level; you have to stay alive a cirtain time to win the level. The scoring is on the enemy car, not the car you control.
It was working perfectly fine until I got an error for having my backround for level 1 too long.
If you need any more info (I assume you will) don't hesitate to ask.
Need this for a school project in 2 weeks. Please help!
Thanks,
bomberswarm2
#2
Posted 01 June 2012 - 10:39 AM
trying to figure out what is wrong without the code is like shooting in the dark.
And do you use D&D or code?
#3
Posted 04 June 2012 - 11:59 AM
Please provide the 'Start game' button click event,
trying to figure out what is wrong without the code is like shooting in the dark.
And do you use D&D or code?
What's D&D?
Under the 'Start Game' Button it has
- Create - Play sound sound_backround
- Left Button - Execute a piece of code {room_goto(Level_1)}
#4
Posted 04 June 2012 - 12:11 PM
Level_1 is the name of the room?
Is it possible that you have a name conflict? maby some other resource that is called "Level_1" ?
Also try
room_goto(room_get_name(Level_1))
#5
Posted 04 June 2012 - 12:31 PM
D&D stands for drag and drop.
Level_1 is the name of the room?
Is it possible that you have a name conflict? maby some other resource that is called "Level_1" ?
Also tryroom_goto(room_get_name(Level_1))
It goes to level 1. But when I reach my scoring limit for the level, which is 10,000, it's meant to goto level 2. Instead, it just starts level 1 again.
#6
Posted 04 June 2012 - 02:36 PM
if score=10000 room_goto(Level_2)in step event
#7
Posted 04 June 2012 - 03:27 PM
if score=10000 room_goto(Level_2)in step event
Change that to
if score==10000 and room=Level_1
room_goto(Level_2);
#8
Posted 04 June 2012 - 04:29 PM
if score=10000 room_goto(Level_2)in step event
Change that to
if score==10000 and room=Level_1
room_goto(Level_2);
Ór just make sure that your levels are placed in order (in gamemaker) so first level 1, beneath level 1 comes level 2 etc.
Then add this in step event instead of the previous code:
if score==10000 room_goto_next()This way you don't have to change the code each time you add a level.
Edited by Tobias(NL), 04 June 2012 - 04:33 PM.
#9
Posted 04 June 2012 - 04:41 PM
An alternative might be
if score==10000*(room-Level_1+1)
room_goto_next();
Of course this method is much trickier. The OP would have to export then re-import all the rooms into a new project after first arranging them in the proper order in the drop-down list, assuming all the levels are immediately below Level_1 with no other types of rooms in between them.
Edited by TheouAegis, 04 June 2012 - 04:41 PM.
#10
Posted 04 June 2012 - 05:06 PM
Yet why not just resetting the score when going to the next room? Or does he want to keep the score after a level is completed?
If that's the case, you could add the score of a completed level to global.totalscore for example. Then reset the normal in-game score and continue to the next level.
Edited by Tobias(NL), 04 June 2012 - 05:13 PM.
#11
Posted 04 June 2012 - 05:26 PM
He would have to reset the score every time. By saying "if score==10000 room_goto_next()", then he will jump to the last level as soon as score hits 10000 because the score will be 10000 in the next room and the next and the next.
An alternative might be
if score==10000*(room-Level_1+1)
room_goto_next();
Of course this method is much trickier. The OP would have to export then re-import all the rooms into a new project after first arranging them in the proper order in the drop-down list, assuming all the levels are immediately below Level_1 with no other types of rooms in between them.
I'd change it to this though
if score > 10000*(room-Level_1+1)
{
room_goto_next();
}
Just incase your score gets higher than 10000
#12
Posted 04 June 2012 - 05:33 PM
He would have to reset the score every time. By saying "if score==10000 room_goto_next()", then he will jump to the last level as soon as score hits 10000 because the score will be 10000 in the next room and the next and the next.
An alternative might be
if score==10000*(room-Level_1+1)
room_goto_next();
Of course this method is much trickier. The OP would have to export then re-import all the rooms into a new project after first arranging them in the proper order in the drop-down list, assuming all the levels are immediately below Level_1 with no other types of rooms in between them.
I'd change it to this thoughif score > 10000*(room-Level_1+1) { room_goto_next(); }
Just incase your score gets higher than 10000
Then subtract 1, else you'll need MORE score to proceed, which is ugly.
if score > 10000-1*(room-Level_1+1)
{
room_goto_next();
}
Edited by Tobias(NL), 04 June 2012 - 06:30 PM.
#13
Posted 04 June 2012 - 09:54 PM
He would have to reset the score every time. By saying "if score==10000 room_goto_next()", then he will jump to the last level as soon as score hits 10000 because the score will be 10000 in the next room and the next and the next.
An alternative might be
if score==10000*(room-Level_1+1)
room_goto_next();
Of course this method is much trickier. The OP would have to export then re-import all the rooms into a new project after first arranging them in the proper order in the drop-down list, assuming all the levels are immediately below Level_1 with no other types of rooms in between them.
I'd change it to this thoughif score > 10000*(room-Level_1+1) { room_goto_next(); }
Just incase your score gets higher than 10000
Then subtract 1, else you'll need MORE score to proceed, which is ugly.if score > 10000-1*(room-Level_1+1) { room_goto_next(); }
I did that but when it goes to level 2 it passes it because its 10,000 - The other posts didn't seem to work either. When it gets 10,000 it goes to the pause menu, which is after level 2.
#14
Posted 05 June 2012 - 05:19 AM
The correct code to use (combining all the posts, even the misguided one right above you) is:
if score >= 10000*(room - Level_1+1)
room_goto_next()
What that does is checks if the score is GREATER THAN OR EQUAL TO a value of 10000 for each room level.
The code you quoted that was posted above you actually says
if score > 10000 - room + Level_1 - 1
And I will reiterate what I said in my post about why that method is trickier. You will need to organize the list of rooms on the left side of Game Maker in a manner such as follows:
Title_Screen
Main_Menu
Pause_Menu
Game_Over
Level_1
Level_2
Level_3
But that won't change the values of the rooms just that way. After organizing the rooms in such a way -- so that Level_2 is immediately below Level_1 and Level_3 is right below Level_2 and so on and so forth -- you need to EXPORT RESOURCES (under the File Menu). Give the .gmres file whatever name you want. Then create a new project so you are working with a clean slate. Then goto the File Menu again and choose IMPORT RESOURCES. Select the .gmres file you made earlier and import all the files into this project. By doing so, you will rewrite the ID for each of the rooms. For example, you might get the following values:
Level_1 = 5
Level_2 = 6
Level_3 = 7
Whereas if you didn't import the rooms into a new project, you might be working with:
Level_1 = 1
Level_2 = 3
Level_3 = 8
This is because rooms are given ID values based on when they were created in GM. However, if you import rooms into a new file, the ID values will be reassigned based on the order in which the rooms were exported, which is done in the order they are listed in your original project.
Edited by TheouAegis, 05 June 2012 - 05:33 AM.
#15
Posted 08 June 2012 - 12:08 AM
1. The scoring on level 2 seems to be half the speed of the level 1 scoring.
2. How do I put in a message that says 'Level Up' or something similar?
3. How do I make this work for more levels?
#16
Posted 13 June 2012 - 02:28 AM
Run in debug mode and set the score to 10000*(room-Level_1+1) then verify the score is what you want it to be.
For the level up, you can do something like set an alarm and in that alarm event just put alarm[n]=-1 (where n is whatever alarm you used). Then in the draw event (preferably of an invisible controller object) put
if alarm[n] >0
{
draw_set_halign(fa_center);
draw_text(view_xview+view_wview/2,view_yview+view_hview/2,"Level Up!");
draw_set_halign(fa_left);
}
You might want to put a sleep command in or something like that so the enemies stop moving or whatever.
Edited by TheouAegis, 13 June 2012 - 02:33 AM.
#17
Posted 22 June 2012 - 12:05 AM
***
Please do not illegally bump your topic. You must wait at least 48 hours before you can legally bump. If you have new information to add, you should edit your last post.
You can find the forum bumping rules here. You may edit your post to remove this message.
- Mnementh
#18
Posted 22 June 2012 - 02:55 AM
if score <= (the amount of points that he should have when he finishes that level) room_goto(level 2)
Edited by GamingBud, 25 June 2012 - 10:14 PM.
#19
Posted 21 July 2012 - 10:52 PM
room_goto_next
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











