GameMaker Manual - GameMaker.info (2024)

Main actions, set 1

The following set of actions deals with creating, changing, and destroying instances ofobjects, with sounds, and with rooms.

GameMaker Manual - GameMaker.info (1) Create Instance
With this action you can create an instance of an object. You specify whichobject to create and the position for the new instance. If you check the Relative box,the position is relative to the position of the current instance. Creatinginstances during the game is extremely useful. A space ship can create bullets;a bomb can create an explosion, etc. In many games you will have some controllerobject that from time to time creates monsters or other objects. For the newlycreated instance the creation event is executed.

GameMaker Manual - GameMaker.info (2) Create Moving
This action works the same as the action above but with two additional fields.You can now also specify the speed and direction of the newly created instance.Note that if you check the Relative box, only the position is relative,not the speed and direction. For example, to make a bullet move in the directionof the person shooting you have to use a little trick. As position use0,0 and check Relative. As direction we need the current directionof the instance. This can be obtained by typing in the word direction.(This actually is a variable that always indicates the current directionin which the instance is moving.)

GameMaker Manual - GameMaker.info (3) Create Random
This action lets you create an instance of one out of four objects. You specifythe four objects and the position. An instance of one of these four objectsis created at the given position. If you check the Relative box,the position is relative to the position of the current instance. If you needa choice out of less than four objects you can use No Object for some of them.This is for example useful to generate a random enemy at a location.

GameMaker Manual - GameMaker.info (4) Change Instance
With this action you can change the current instance into an instance ofanother object. So for example, you can change an instance of a bomb intoan explosion. All settings, such as the motion and the value of variables,will stay the same. You can indicate whether or not to perform the destroyevent for the current object and the creation event for the new object.

GameMaker Manual - GameMaker.info (5) Destroy Instance
With this action you destroy the current instance. The destroy eventfor the instance is executed.

GameMaker Manual - GameMaker.info (6) Destroy at Position
With this action you destroy all instances whose bounding box contains agiven position. This is useful, for example, when you use an exploding bomb.When you check the Relative box the position is taken relative tothe position of the current instance.

GameMaker Manual - GameMaker.info (7) Change Sprite
Use this action to change the sprite for the instance. You indicate which new sprite.You can also indicate with subimage must be shown. Normally you would use 0 forthis (the first subimage) unless you want to see a particular subimage. Use -1 ifyou do not want to change the current subimage shown. Finallyyou change the speed of the animation of the subimages. If you only want to seea particular subimage, set the speed to 0. If the speed is larger than onesubimages will be skipped. If it is smaller than 1 subimages will be shownmultiple times. Don't use a negative speed. Changing sprites is an important feature.For example, often you want to change the sprite of a character depending onthe direction in which it walks. This can be achieved by making different spritesfor each of the (four) directions. Within the keyboard events for the arrow keysyou set the direction of motion and the sprite.

GameMaker Manual - GameMaker.info (8) Transform Sprite
Use this action to change the size and orientation of the sprite for the instance.Use the scale factors to make it larger or smaller. The angle gives the counter-clockwiseorientation of the sprite. For example, to make the sprite oriented in the direction ofmotion use as a value direction. For example, this is useful for a car. You can alsoindicate whether the sprite should be mirrored horizontally and/or flipped vertically.This action is only available in the Standard Edition.

GameMaker Manual - GameMaker.info (9) Color Sprite
Normally the sprite is drawn as it is defined. Using this action you can change thecolor of the sprite. This color is blended with the sprite, that is, it is combinedwith the colors of the sprite. If you want to draw a sprite in different colors youbetter define the sprite in black and white and use the blend color to set theactual color. You can also indicate an alpha transparency. With a value of 1 thesprite is opaque. With a value of 0 it is completely transparent. With a value inbetween you will partially see the background shine through it. This is great formaking explosions.This action is only available in the Standard Edition.

GameMaker Manual - GameMaker.info (10) Play Sound
With this action you play one of the sound resources you added to your game.You can select the sound you want to play and choose whether it should play only once(the default) or loop continuously. Multiple wave sounds can play at once butonly one midi sound can play at a time. So if you start a midi sound, the current midisound is stopped.

GameMaker Manual - GameMaker.info (11) Stop Sound
This action stops the indicated sound. If multiple instances of this soundare playing all are stopped.

GameMaker Manual - GameMaker.info (12) Check Sound
If the indicated sound is playing the next action is performed. Otherwiseit is skipped. You can select Not to indicate that the next actionshould be performed if the indicated sound is not playing. For example,you can check whether some background music is playing and, if not, startsome new background music.Note that this action returns true when the sound actually plays through the speakers. After you call theaction to play a sound it does not immediately reach the speakers so the actionmight still return false for a while. Similar, when the sound is stopped you still hearit for a while (e.g. because of echo) and the action will still return true.

GameMaker Manual - GameMaker.info (13) Previous Room
Move to the previous room. You can indicate the type of transition effectbetween the rooms. You should experiment to see what works best for you. When the rooms donot have the same size you better do not use transitions.If you are in the first room you get an error.

GameMaker Manual - GameMaker.info (14) Next Room
Move to the next room. You can indicate the transition.

GameMaker Manual - GameMaker.info (15) Restart Room
The current room is restarted. You indicate the transition effect.

GameMaker Manual - GameMaker.info (16) Different Room
With this action you can go to a particular room. You indicate the room and thetransition effect.

GameMaker Manual - GameMaker.info (17) Check Previous
This action tests whether the previous room exists. If so, the next actionis executed. You normally need this test before moving to the previous room.

GameMaker Manual - GameMaker.info (18) Check Next
This action tests whether the next room exists. If so, the next actionis executed. You normally need this test before moving to the next room.

« Move actions | Main actions, set 2 »

GameMaker Manual - GameMaker.info (2024)
Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 5854

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.