A series of topics discussing certain features of Mac GameMaker. If you have ideas on additional topics or think current ones should be updated or revised, please email me at AlStaff@aol.com
Document revised 02/26/10
*** This is for Macintosh GameMaker. It is very different than Windows Game Maker ***
Video Tutorials - Created by Silverwind on 11/06/09 (updated 2/26/10)
The inventory system is very easy to use. It's limited to holding 15 items and you can only equip 1 item at a time, but if you simply want your game to be able to use items that are in the players inventory then you don't have to force the player to equip any items at all.
The inventory system consists of the following commands
To show the list of inventory items the player has:
That will show a window with the list of items. If you have the Inventory button showing at the bottom of the game window, the player can click that to automaticaly show the inventory window ,so you may not even need to use this command anywhere. The inventory window lets the player pick an item to equip. All they have to do is click the mouse on an item in the list and it will automatically be the equipped item.
You can also equip an item in code rather than having the player pick one:
INVENTORY SELECT sword
That will equip the sword if it's in the inventory list.
To check if an item is in the inventory:
bool = INVENTORY item$
So if you are checking to see if the player has a sword:
x = INVENTORY sword
IF x = 1 THEN
' the sword is in the inventory list if x = 1.
If you only want to check if an item is the equipped item then check the built in inventory$ variable. That will hold the current equipped item:
IF inventory$ = "sword" THEN
' if it does then the sword is the equipped item
When the player finds an item and you want to add it to the inventory:
INVENTORY ADD sword
That adds the sword to the inventory window list.
To delete an item from the inventory
INVENTORY DELETE sword
To delete the entire inventory list, just use
without putting any item after it.
This is probably the easiest inventory system in any game creator because you can let GameMaker handle most of it if you have the "Show Inventory" button selected in the main editor window. Then all you have to do is add items, delete items and check that they player has them.
First make sure the status bar option is on. To turn it on, select "Game Options" in the "Go" menu and make sure the "Use status bar" box is checked. Clicking the "bar options" button displays a window to create a name for the bar, set the maximum value for the bar (1 to 100) and change the card numbers that GameMaker will branch to when the bar is either empty or full. Once the status bar is active, you will be able to see the bar at the lower left side in the main GameMaker editor window.
Click on a card button to open the button script window. The pop-up menu for the status bar should work if the bar is active. There are 2 sections to this menu. The top lets you select whether you want to add or subtract points from the bar. The bottom lets you select which card to branch to if the bar becomes empty (or full if that was your selection in the set up). The text field next to the pop up menu lets you type in a number of how much to add or subtract from the bar.
Example. Suppose you select "Subtract " on the top part and you select "248" on the lower part and you have 1 in the text field. When the player clicks the button, the bar will decrease by 1. If that decrease makes the bar equal 0 (empty), then GameMaker will go to card 248.
The following commands and built in variables can be used to manipulate the statusbar:
Hides the status bar.
Shows the statusbar if it was hidden or lets you change the name of the bar. The statusbarname parameter isn't needed if you only want to show the bar without changing the name.
STATUSBAR amount cardnumber maxvalue
Adds 'amount' to the status bar. A negative number moves the bar to the left and a positive number moves the bar to the right. The 'cardnumber' is the card that GameMaker should go to if the bar is at either 0 or at the maximum value for the bar after adding 'amount' to it. The optional 'maxvalue' parameter lets you set the maximum value for the status bar. It can be set from 1 to 100.
Built in Variable
This variable returns the current value of the Status Bar. You can also use it to set the value of the Status Bar. For other ways of using the Status Bar, see the STATUSBAR command.
First make sure the counter option is turned on. To turn it on, select "Game Options" in the "Go" menu and make sure the "Use counter" box is checked. There is a built in variable for the counter named "Counter" which GameMaker looks at to keep track of the counter number being displayed. If the variable changes, the counter is updated on the screen. To increase the counter by 1, your script should look like this:
counter = counter + 1
The number showing in the window will automatically be inreased by 1. You can also set the counter to any number:
counter = 100
That will set the counter to 100.
All sound and music formats besides System sounds are played using QuickTime, so the QuickTime extensions must be installed. Newer sound formats will require newer versions of QuickTime. The sound or music file to be played must be in the same folder as your game. Use the MOVIE command to play the sound. For example, if the file you want to play is named MySound.wav, then the command would look like this:
MOVIE 0 0 MySound.wav
The "0 0" in the command above are for coordinates to place a movie, but since there's no movie track in sound and music files, you should leave the coordinates at 0.
Use GraphicConverter to save the files as transparent gif files. If you have Photoshop, here is a suggestion from a GameMaker user (I haven't tried this): In Photoshop, to save as transparent you have to go to menu "File" then "Save for web" and set the background to transparent.
Visitors to this web site since 6/19/03:
Back to the GameMaker page
Go to Al's Home Page