Pages: 1 ... 41 42 [43] 44 45 ... 60
  Print  
Author Topic: Game Maker Help Thread!  (Read 43557 times)
halibabica
Bossy
Mossy
*
Posts: 1920


*whipcrack*


View Profile WWW Email
« Reply #630 on: December 02, 2010, 04:45:31 PM »

Under 'Scripts' select 'Search in Scripts' and type in what you want to find.  This will find what you typed in any of Spelunky's scripts and list them out for you.  Unfortunately, it doesn't search through objects.
Logged

Sometimes I wonder if I like Spelunky too much.
ManTrap mod - Tastes Like Spelunky
Hand-drawn comic - Spelunkying
Moloch
Mossbaby
*
Posts: 367



View Profile WWW
« Reply #631 on: December 02, 2010, 07:22:46 PM »

To search through objects you can select 'Show Object Information' from the Edit menu (this will list the code of every object..Spelunky has a lot of objects so you will probably have to wait several seconds), then you can save it to a text file and search that with your favorite text editor.  If anyone knows of an easier way, please post it.
Logged

zetsu
Shoot
*
Posts: 24



View Profile
« Reply #632 on: December 03, 2010, 09:29:35 AM »

Do you know how the control keys are loaded, and if you do where the code is for it?
I know that they're set with the config program but i don't know where the code is that writes the controls.
Logged

Snow Dies Now
Moloch
Mossbaby
*
Posts: 367



View Profile WWW
« Reply #633 on: December 03, 2010, 11:26:39 AM »

Do you know how the control keys are loaded, and if you do where the code is for it?
I know that they're set with the config program but i don't know where the code is that writes the controls.

For the config program the keys.cfg and gamepad.cfg are written in oKeyConfig/oJoyConfig 'Room End' events.

For Spelunky all the settings/controls are loaded by scrInit.
Logged

zetsu
Shoot
*
Posts: 24



View Profile
« Reply #634 on: December 03, 2010, 02:59:41 PM »

Sorry to keep bothering you but what is global?
I see it referenced a lot but i'm not familiar with GameMaker.

{
  if (global.joyStartVal > 0)
}
||
{
  if (global.isDamsel)
}

things like those
Logged

Snow Dies Now
ManaUser
Bean
*
Posts: 145


View Profile
« Reply #635 on: December 03, 2010, 04:00:15 PM »

Essentially global is a fake object used to store global variables, meaning you can access global.isDamsel from any script or event code.
Logged

Things that hop are evil.
zetsu
Shoot
*
Posts: 24



View Profile
« Reply #636 on: December 03, 2010, 04:35:34 PM »

oh so { global.isDamsel } would return a boolean value named isDamsel?
Logged

Snow Dies Now
Moloch
Mossbaby
*
Posts: 367



View Profile WWW
« Reply #637 on: December 03, 2010, 06:12:42 PM »

A normal (local) variable is assigned to a particular object/instance, like how each enemy has a hp variable of their own to keep track of their health. When that enemy is destroyed, all its variables are gone.
When you finish a level and go to the next one, (nearly) everything in the old room (including the player) is destroyed, then in the next room a new player is created at the start position. So to keep track of things like player health, money, etc from level to level they are stored in global.plife, global.money, global.bombs, etc.

oh so { global.isDamsel } would return a boolean value named isDamsel?

global.isDamsel will return a boolean value. It doesn't return another variable just named isDamsel if that's what you mean. The 'global.' in front of it just means that you can change/reference it from anywhere in the game. That's why all the keyboard/gamepad keys are stored in globals like global.joyStartVal when the game is started, otherwise you would have to do something like load the .cfg files again every time you went to another room (or use a persistent object - but don't worry about that).
Logged

zetsu
Shoot
*
Posts: 24



View Profile
« Reply #638 on: December 03, 2010, 06:31:15 PM »

so
{
  stringy = file_text_open_read("keys.cfg");
  if (file)
  {
    global.keyUpVal = real(file_text_read_string(stringy));
         file_text_readln(stringy);
  }
}

says to the compiler
{
1. assign stringy to a string that is what is contained in the file "keys.cfg";
2. if stringy isn't an empty string then;
  2-1. assign the variable in the "global" object with the name "keyUpVal" to the
         character associated with the ascii value found that is equals to the
         parsed int of the first string on the first line of stringy;
  2-2. go to the next line of stringy;
}
or something similar?

I know a tiny bit of Java so would it be similar to using the Scanner object in java?
« Last Edit: December 03, 2010, 06:33:59 PM by zetsu » Logged

Snow Dies Now
Moloch
Mossbaby
*
Posts: 367



View Profile WWW
« Reply #639 on: December 03, 2010, 08:51:03 PM »

Yep. But "if (file)" should say "if (stringy)".

(I don't know any Java)
Logged

zetsu
Shoot
*
Posts: 24



View Profile
« Reply #640 on: December 03, 2010, 10:01:47 PM »

That's what i meant but i changed the names from the actual code so it wouldn't be as confusing when i referenced the variable "file" as opposed to the file "keys.cfg".

thanks for the help. I'll probably have some more questions later.
Logged

Snow Dies Now
zetsu
Shoot
*
Posts: 24



View Profile
« Reply #641 on: December 06, 2010, 09:45:13 AM »

How does the program tell the spelunker to move, and what monitors keyboard input?

and what is the gamepad object?
« Last Edit: December 06, 2010, 02:55:12 PM by zetsu » Logged

Snow Dies Now
halibabica
Bossy
Mossy
*
Posts: 1920


*whipcrack*


View Profile WWW Email
« Reply #642 on: December 06, 2010, 04:59:48 PM »

There's a script called CharacterStepEvent where it checks stuff related to controls.  They mostly refer to the whole pile of scripts in the folder called 'Control'.  This is where it checks for any and all buttons being pressed.

The gamepad object only comes into play if a gamepad is being used.  I really don't know much about it beyond that.
Logged

Sometimes I wonder if I like Spelunky too much.
ManTrap mod - Tastes Like Spelunky
Hand-drawn comic - Spelunkying
zetsu
Shoot
*
Posts: 24



View Profile
« Reply #643 on: December 06, 2010, 06:21:52 PM »

is the script called by the oPlayer1 object or a different object?
Logged

Snow Dies Now
marsgreekgod
Big Bossy
Mossy
*
Posts: 9773


The will of the Galaxy.


View Profile WWW Email
« Reply #644 on: December 06, 2010, 10:49:07 PM »

any chance some one can help me fake a planet gravity program >?
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Pages: 1 ... 41 42 [43] 44 45 ... 60
  Print  
 
Jump to: