In Game Maker, I am trying to make it so that three instances of an object have three different sprites. Using DnD, what would be the optimal way to do this? If it helps, the three instances are different sizes and are in separate, fixed places.

EDIT: I have added the following, and it gives an error that the global variable has not been set. administrater code error message text code load order

  • \$\begingroup\$ What's in the step event? \$\endgroup\$ – Boneco Sinforoso Oct 1 '19 at 22:24
  • \$\begingroup\$ @boneco It just opens and closes an ini file. I have not worked on that part of my game yet. \$\endgroup\$ – user132400 Oct 1 '19 at 22:27
  • \$\begingroup\$ Do you try to pass the value of the global variable to this file.ini in the step event? \$\endgroup\$ – Boneco Sinforoso Oct 1 '19 at 22:30
  • \$\begingroup\$ @boneco No it just opens and closes the ini file every step without doing anything to the file. \$\endgroup\$ – user132400 Oct 1 '19 at 22:31
  • \$\begingroup\$ Please upload your project to google drive and give me the link. From the images I can not identify what is wrong. \$\endgroup\$ – Boneco Sinforoso Oct 1 '19 at 23:47

To do this, you will need:

  • 1 controller/administrator/creator object (obj_Hades in my project)
  • 1 global variable (global.number in my project)

The controller object (obj_Hades) will basically serve for you to declare the global variable (global.number).

Note that a sprite contains 3 images/frames:

enter image description here

In the controller object (obj_Hades):

enter image description here

Be careful to place the controller object to be initialized first (see lower left corner of image above).

In the object to have three different shapes:

enter image description here

Remember to set the image_speed variable to 0, so that you don't run an animation.


enter image description here



If you have separated the images:

enter image description here

Just make use of IF'S.


Test done with your project:

enter image description here

I deleted the 3 objects and added them again. I realized that the ones you had placed in the room were different sizes, I don't know where you modified them, but apparently that was the cause of the problem.

  • \$\begingroup\$ I have the controller object initialized first as shown in the photo but for some reason, I keep getting an error saying that the global variable has not yet been set. \$\endgroup\$ – user132400 Oct 1 '19 at 21:35
  • \$\begingroup\$ @K.O. Make an addition showing what you did and add to the question. \$\endgroup\$ – Boneco Sinforoso Oct 1 '19 at 21:51
  • \$\begingroup\$ I have added the additions to the question. \$\endgroup\$ – user132400 Oct 1 '19 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy