Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1] 2   Go Down

Author Topic: [Request / Listing] Solved-Save Files  (Read 9885 times)

0 Members and 1 Guest are viewing this topic.

King Tetiro

Leader of Phoenix Heart
[Request / Listing] Solved-Save Files
« on: April 13, 2006, 11:44:20 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I have made my game on game maker version 6.1 and I'm having trouble with my inventory. It's an object but I want it to pause everything apart from it until it's destroyed/closed PLEASE HELP! :'(
« Last Edit: February 24, 2012, 10:45:28 am by Niek »
Logged
  • Phoenix Heart

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #1 on: April 13, 2006, 11:46:49 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
i could be version 6 I don't know
Logged
  • Phoenix Heart

Ben

Re: Inventory Pause trouble
« Reply #2 on: April 13, 2006, 11:51:25 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
The usual way to do it is have a global variable called global.pause.
Now this will be a boolean (can either be true or false). And basically you encompass everything that you don't want to happen when paused within
if (!global.pause){
//code here
}

Now when you open your inventory you set global.pause to true, and so no code is called (because that if will only let you through when global.pause is false). Then when you close it you set global.pause to false, so everything else is called.

Edit: Oh and btw, that modify button up there can be your friend, and it'll stop all the mean kids being mean to you. AKA don't double post.
« Last Edit: April 13, 2006, 11:52:57 am by Ben »
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #3 on: April 13, 2006, 12:04:37 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
could kinda make this understandable, you see i'm not a fast understander (or make an example for little old me) and ta for the tip about the modify button
Logged
  • Phoenix Heart

Ben

Re: Inventory Pause trouble
« Reply #4 on: April 13, 2006, 12:17:28 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
Erm okay.
You've got your code in say the step event of your link object (i assume your making a zelda game).
So imagine your code is "doLinkStuff()"

Now to make it pausable you do this:

Code: [Select]
if (!global.pause){
doLinkStuff();
}

Now I dont' know how your using your inventory, but if your just creating an inventory object then in the create event of that you put:
Code: [Select]
global.pause = true;
And if in getting rid of the inventory your destroying the object you put this in the destroy event:
Code: [Select]
global.pause = false;

Of course make sure that somewhere you've declared the variable first.

Now back to the bit with the if, you simply do this with the step code of every object, and then it *should* work.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #5 on: April 13, 2006, 12:28:27 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I don't mean to sound rude but would you mind making an example for me. Cos I still don't get it! (Sorry for the bother)
Logged
  • Phoenix Heart

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #6 on: April 13, 2006, 01:27:59 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Or you could show how to do it in great detail (if you want to if you don't that's okay)
Logged
  • Phoenix Heart
Re: Inventory Pause trouble
« Reply #7 on: April 13, 2006, 02:32:41 pm »
  • The Broken King
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1259
Lagionaz, the best way to learn is to try. So I'll give you a short example of how it works, and you can try to figure it out from there.

Your object is a horse. During the 'step' event, your horse executes the following code:

Code: [Select]
self.dir = floor(random(4));
if (self.dir = 0)
{
  x -= 1;
}
else if (self.dir = 1)
{
  y -= 1;
}
else if (self.dir = 2)
{
  x += 1;
}
else
{
  y += 1;
}

Now, obviously, this code would not really look very good if you actually ran it, but for example purpose, let's pretend that that makes sense.

Now, say that you created an object that, when it's running, you want to pause the game. In the create even of that object, you'd put the code:

Code: [Select]
global.pause = true;
and in the destroy event, you'd put the code:

Code: [Select]
global.pause = false;
you would also need, at the point where your game starts, to put code that says:

Code: [Select]
global.pause = false;
if you hadn't set 'set uninitialised variables to 0' in your preferences.

Once you have that set up, go back int your hourse object, and alter the code this way:

Code: [Select]
[b]if (!global.pause)  //if the game isn't paused[/b]
{
  self.dir = floor(random(4));
  if (self.dir = 0)
  {
    x -= 1;
  }
  else if (self.dir = 1)
  {
    y -= 1;
  }
  else if (self.dir = 2)
  {
    x += 1;
  }
  else
  {
    y += 1;
  }
[b]}[/b]

This will make it so that the code that moved the horse only ever executes if the game is not paused, which the object will tell the game.

Just a tip for asking for help in the future, people are more willing to help you if you tell them what you have tried, instead of just jumping on here as soon as you have to do something. Additionally, if you have something else to say after you've already posted, and Ben has already said this but you obviously didn't listen, click on the 'modify' button on your old post instead of making a new post if no one else has posted in the topic yet. Posting in the same topic twice in a row is known as 'double posting' and is generally frowned upon in forums, which is one reason why the modify button is there - so that you can add more to your old post without double posting.
Logged
  • Broken Kings [Temp Site]
Re: Inventory Pause trouble
« Reply #8 on: April 13, 2006, 03:07:31 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1902
An easier way to do it would to have in the Create event of the Menu, the code
instance_deactivate_all(1);
And when you press a key, it destroys the menu and it activates the objects using instance_activate_all();
And if you had, like, a pointer object, then do the exact same code for that as you did for the menu.
Logged


.TakaM was here.
Quote
so my friend stole a giant bag of ketchup out of the ketchup pumping things and brought it to our table and we took it in the bathroom and i smashed it over the sink and kicked it around the bathroom and smeared it everywhere and we all took turns kicking the ketchup out of it and when we were done it looked like an african village was murdered in the bathroom
XFD.
  • Awesome Land
Re: Inventory Pause trouble
« Reply #9 on: April 13, 2006, 06:33:24 pm »
  • The Broken King
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1259
The only problem with that way, halotank, is that it causes everything else to disappear.

I had a function that would run a menu, without needing to pause the game because it was just one function, and the game lets functions run while pausing the game at the same time, but that's probably a little too complex for you at this point.
Logged
  • Broken Kings [Temp Site]

Ben

Re: Inventory Pause trouble
« Reply #10 on: April 13, 2006, 06:39:23 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
All you have to do is put the entire thing within a while loop, it's not that hard, but then your right it's probably too hard for him.
I daresay you shouldn't start here in GM anyway.
Jumping into coding isn't helpful.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #11 on: April 13, 2006, 07:19:12 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I'm very good at game maker so what you lot are saying is that in the create event you put global.pause to be true and destroy event it's false. SOOOOO if I got the idea in the step event of say a hero if the global.pause is true, then the thing should pause
(the underline is that I don't understand how)
Logged
  • Phoenix Heart

Ben

Re: Inventory Pause trouble
« Reply #12 on: April 13, 2006, 07:21:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
You understand the idea of code blocks right?
As in:
Code: [Select]
if (var == true){
Dostuff();
DoMoreStuff();
DoSomethingElse();
}

Now in your link object find the step code that you using and at the beginning put:
Code: [Select]
if (global.paused == false){

And at the end put

Code: [Select]
}
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #13 on: April 13, 2006, 07:37:04 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
So do you use sleep for ..... icon
Logged
  • Phoenix Heart

Ben

Re: Inventory Pause trouble
« Reply #14 on: April 13, 2006, 07:38:42 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
Are you using code or Drag and drop? :S
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #15 on: April 13, 2006, 07:40:03 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Drag and drop (I used it a heck of a lot that's how I did my complete heart piece system)
« Last Edit: April 13, 2006, 07:43:11 pm by Laigonaz »
Logged
  • Phoenix Heart
Re: Inventory Pause trouble
« Reply #16 on: April 14, 2006, 03:47:19 am »
  • The Broken King
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1259
This would be a heck of a lot harder in drag and drop..


actually I can't even imagine making a zelda game in drag and drop. Holy cow that'd take forever.
Logged
  • Broken Kings [Temp Site]

King Tetiro

Leader of Phoenix Heart
Re: Inventory Pause trouble
« Reply #17 on: April 14, 2006, 07:00:49 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Not really I nearly have my SECOND demo done
Logged
  • Phoenix Heart
Re: Inventory Pause trouble
« Reply #18 on: April 15, 2006, 01:51:58 pm »
  • *
  • Reputation: +4/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4747
Laigonaz, stop the triple posting...edit your post if you want to say more...
Logged

Piers

Re: Inventory Pause trouble
« Reply #19 on: April 15, 2006, 02:09:39 pm »
This would be a heck of a lot harder in drag and drop..


actually I can't even imagine making a zelda game in drag and drop. Holy cow that'd take forever.
Actually its not as hard as it seems. Most Gml has a d&d equivalant.
Logged
Pages: [1] 2   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.203 seconds with 77 queries.