Object (Game Maker)

Objects are are core of object oriented programming . Just about anything in your game that can interact with something will be an object. Your main character, enemies, level walls, etc will probably all be objects. Actually, that's not quite true.

An object is actually a definition of a type of something. You use it to create instance of the object in the game. To understand this, let's make an analogy. An object is a cookie cutter. It contains the shape and size of the cookie. You can use a cookie cutter to make as many cookies as you want.

It is the same with objects and instances: if you define an alien ship as an object, lets say, with the name obj_alien_ship. Then, whenever you need an alien ship, you create an instance of it. If you need more than one alien ship, you can create as many instances of the object obj_alien_ship as you want. All of the instances will have the same qualities as the object it was created from.

Parent Object

Since GML is an object based language, objects can inherit code and properties from their parents. This is a very powerful and time saving feature of Game Maker. If you make a parent object for all enemies, the Collision event for the parent object will apply to all children of the parent object.

Object Naming Conventions

Objects are typically named by programmers to help remind them what they are, below is a list of prefixes used in these naming conventions :

  • obj_ (obj_player) - ordinary object
  • con_ or cont_ (cont_scroller) - controller object
  • par_ (par_wall) - parent object
page revision: 13, last edited: 05 Jul 2012 18:26
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /