![]() ![]() Controller objects are used to control and draw such things as menus and huds and perform such functions as change the room based on score. In other words, controller objects run things behind the scenes. Controller ObjectsĬontroller objects are used to control various aspects of a the game that you do not want to control with the player object. Most control code is contained in the player object because it is the object being controlled. ![]() The player object is the object that represents the player. They are considered different because they are put to a special use. They are constructed just like any ordinary object. The types of objects below are not special objects. If you want to use the Draw event of an instance and have it's sprite displayed, you will have to draw the sprite manually with draw_sprite(). If you are using the Draw event of an object, it's sprite will not be automatically drawn, and therefore the instance will not be seen. To draw the sprite immedietly, put the draw sprite under a room start or game start event. An instance of an object without an assigned sprite will not be seen, nor will it be able to "collide" with anything, as collision detection is based on sprites. This sprite is displayed during the Draw event every step automatically. Objects are assigned sprites using sprite_index. All of the instances will have the same qualities as the object it was created from. If you need more than one alien ship, you can create as many instances of the object obj_alien_ship as you want. Then, whenever you need an alien ship, you create an instance of it. 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. Each instance created "knows" which object it was created from because it has a variable, object_id which contains the index of the object prototype. You can use a cookie cutter to make as many cookies as you want. It contains the shape and size of the cookie. To understand this, let's make an analogy. You use it to create instance of the object in the game. Actually, that's not quite true.Īn object is actually a definition of a type of something. Your main character, enemies, level walls, etc will probably all be objects. Just about anything in your game that can interact with something will be an object. Objects are are core of object oriented programming. ![]()
0 Comments
Leave a Reply. |