Jump to content


Photo

Large Error with my rooms


  • Please log in to reply
18 replies to this topic

#1 bomberswarm2

bomberswarm2

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

Posted 01 June 2012 - 10:14 AM

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

#2 zehevi

zehevi

    GMC Member

  • GMC Member
  • 637 posts
  • Version:GM8

Posted 01 June 2012 - 10:39 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?
  • 0

#3 bomberswarm2

bomberswarm2

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

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)}

  • 0

#4 zehevi

zehevi

    GMC Member

  • GMC Member
  • 637 posts
  • Version:GM8

Posted 04 June 2012 - 12:11 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 try
room_goto(room_get_name(Level_1))

  • 0

#5 bomberswarm2

bomberswarm2

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

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 try

room_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.
  • 0

#6 Tobias(NL)

Tobias(NL)

    GMC Member

  • GMC Member
  • 854 posts
  • Version:Unknown

Posted 04 June 2012 - 02:36 PM

if score=10000 room_goto(Level_2)
in step event
  • 0

#7 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 5216 posts
  • Version:GM8

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);
  • 0

#8 Tobias(NL)

Tobias(NL)

    GMC Member

  • GMC Member
  • 854 posts
  • Version:Unknown

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.

  • 0

#9 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 5216 posts
  • Version:GM8

Posted 04 June 2012 - 04:41 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.

Edited by TheouAegis, 04 June 2012 - 04:41 PM.

  • 0

#10 Tobias(NL)

Tobias(NL)

    GMC Member

  • GMC Member
  • 854 posts
  • Version:Unknown

Posted 04 June 2012 - 05:06 PM

Oh yeah, true.

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.

  • 0

#11 aaabbbccc

aaabbbccc

    GMC Member

  • GMC Member
  • 525 posts

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

#12 Tobias(NL)

Tobias(NL)

    GMC Member

  • GMC Member
  • 854 posts
  • Version:Unknown

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 though

if 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.

  • 0

#13 bomberswarm2

bomberswarm2

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

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 though

if 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.
  • 0

#14 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 5216 posts
  • Version:GM8

Posted 05 June 2012 - 05:19 AM

That last code he posted doesn't work because it's bad math.

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.

  • 0

#15 bomberswarm2

bomberswarm2

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

Posted 08 June 2012 - 12:08 AM

Okay it worked but I didn't need to import it. But there are still a few problems
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?
  • 0

#16 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 5216 posts
  • Version:GM8

Posted 13 June 2012 - 02:28 AM

What do you mean half the speed? Are you sure you didn't reset the score when you moved to the next room? Also, are you sure the score requirement is being set properly?

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.

  • 0

#17 bomberswarm2

bomberswarm2

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

Posted 22 June 2012 - 12:05 AM

Well how do I set it togo from level 2 to level 3, because at the moment it won't.

***
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

  • 0

#18 GamingBud

GamingBud

    GMC Member

  • New Member
  • 20 posts
  • Version:GM8

Posted 22 June 2012 - 02:55 AM

ok i see your problem what you need to do is create an object and name it: Score_Check and in Score_Check put a create action in it and in that create action drag a alarm 0 in it and put the number of steps to 1 and then create an alarm 0 action and in that alarm 0 action drag a execute code in it and in that code put:
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.

  • 0

#19 NEPC

NEPC

    GMC Member

  • GMC Member
  • 46 posts
  • Version:GM8.1

Posted 21 July 2012 - 10:52 PM

Why not use this:
room_goto_next

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users