parent

  1. F

    GML how to store multiple kinds of instances with their x and y coordinate

    basically what I'm trying to do is make it so that when the player presses Z, each instance of every object parented to a parent object is stored but is no longer in the room and a new setup is drawn, and when the player presses Q, the new setup is stored and the old one is shown and i need to...
  2. S

    Collision in parent object

    hi, I'm trying to make a global collision in a parent object for all his children but the collision event or place_meeting function don't work ... Any Idee?
  3. Ayziak

    GMS 2 Reference a parent object without the children?

    Hi all! In my game, the enemies cannot see the player through solid walls (OBJ_Solid) but should be able to see through OBJ_Platform's. I use this to detect the player: if !collision_line(x+4,y-4,Player.x,Player.y,OBJ_Solid,false,true) {//do something} My problem is that OBJ_Platform is a...
  4. T

    (GML2) How do I access my parent's variable?

    In the parent object (create), I have: var AC = 10; In the Child Object (create), I have: event_inherited(); show_message(string(AC)); But I get an error, saying that the variable "not set before reading it." It doesn't matter where I put that line of code (in the create event, or Keypress...
  5. P

    GML Parent object drawing

    Hello, So i am making a game were i want to have states something like hearts of iron 4 and europa universalis 4. So i drew 2 different objects with different sprites and made a parrent object for them. What they are supposed to do is glow (i just made the image a bit yellower) when i press...
  6. M

    (Solved) Affecting one specific child object while using a parent object to check collisions.

    Pretty much what I am trying to do is edit the image alpha of a specific object ID while using the parent object to check for collisions. I need to be able to identify the ID of the object during the collision so the edits to the image alpha will only effect that instance, not the others tied to...
  7. K

    How can i know which child is run the code?

    Hi i have a parent object which contains 4 objects as child in onCreate Event of parent i want to define a variable depending on the object name like this: switch (?????????????){ case object_1: var number = 100; break; case object_2: var number = 200...
  8. L

    Sound commands from a parent object

    Good day everyone. There are a number of car models falling under an obj_car parent. Each car object has a passby variable where, on creation, the type of engine sound is determined. In the step event of the parent, the " if !sound_isplaying" code is checked, and the passby variable is looped...
  9. Guitarmike

    Get instance of clicked-on object

    Hi, I have 2 npcs (obj_npc_1 and obj_npc_2), both of which are children of a parent object obj_npc_controller. When the user clicks on an npc, I want the character to be selected ,i.e. have a white rectangle drawn around him/her in the GUI layer. Here is my code: //obj_game CREATE event...
  10. Gun_Goose

    Destroying a specific instance of a child object

    Hi, I am making a game where you move a character to avoid bullet like projectiles. I have a lot of different projectiles, so I made a parent class that all the bullet object would fall under. When the player collides with a bullet, a would like to destroy that specific instance. However, I...
  11. DarklinkFighter

    GML Parenting vs Composition... (When to use what - Examples)

    Hi, as a C++ / C# / Java Programmer I struggle a bit now when I want to refactor some stuff from my first Test Project with GMS2... I tend to break my head when it's better to use composition and when it's better to use parenting in Game Maker... In other languages I can just implement...
  12. Le Slo

    GMS 2 With statement and child objects

    Hello! I've been having troubles I don't really understand with the with statement and object parenting. Here is what I have: -An obj_laser. -An obj_laserAttack (child object of obj_laser). So, I need to save the positions of those objects, and for that I use the following to save the...
  13. breakmt

    Question - IDE Create groups inside parent room

    Hello. I think one function in rooms "parent-child" system is missing - creating groups inside parent room. For example, I want create parent room for all levels. Inside this parent room I want to create few groups - "home", "street", "forest" etc. Each of these groups will contain several rooms...
  14. Nathan Laing

    Legacy GM [SOLVED] Does each instance get it's own list?

    Greetings, The following code is called from say, "object A". There are other objects, and they are children of the object, "obj_parent". Does the code below create a ds_list inside each child object? Or, as I would like to have happen, is only ONE ds_list created inside the calling instance...
  15. Nathan

    Mac OSX Room Parenting question, retro-parenting?

    So my game was created before parenting with rooms was an option. Is it possible to take a pre-existing room and parent it (make it a child) to a newly created Parent Room? Or do I need to rebuild all previously created rooms(stages) in order to make use of Room Parenting now?
  16. A

    GML All children of a parent share the same variables..? [SOLVED]

    I have a variable called hp. It's on the obj_slime create event. The slime is also parented to par_enemy. The problem is that, I have an attacker, and I don't wanna copy huge chunks of code for every single enemy in the game. So I created a parent for all enemies, and the when the attacker...
  17. Dagoba

    Legacy GM Recognize the same child from the same parent

    Hello! In my game, there are 8 different objects with the same parent. I want to know, how to check during collision if the child objects are the same objects. If for example an apple, tomato and pear are par_fruit's children, how to check if apple collides with another apple? I tried this...
  18. S

    How to check how many instances have the same parent?

    Hello. So, in the game I'm working on, multiple characters can occupy the same space at once and when this happens, I place all of them in the corners of the space (Think: Sudoku hints). In order to keep this in a set fashion, I intend to number each instance. However, they are all different...
  19. P

    Tutorials and Global Variables

    Hello. So let me start by saying I am slowly learning more and more. One of the things I have learned is the potential disaster that is Global Variables. I have been following a tutorial on RTS Turn based games. However this tutorial, while teaching me a lot, left me in a hole I can't dig...
  20. A

    Child Instance Destroy When Parent Instance Destroyed?

    I'm working on a new project idea with a limited number of instances off an object at any given time (3). Each of those have 1 separate object instance that they create. All these pairs are the same. So there's 3 pairs of object instances "allowed" No more than 3 pairs can be existing. Some...
Top