inheritance

  1. W

    GMS 2.3+ Children not inheriting

    I have an object named pPlayerEntity which contains all the keyboard input movements and some information about a player state machine I have set up. My goal here is to have the player control multiple different little characters throughout the game. I thought I would do this by having the...
  2. flyinian

    SOLVED Could someone give me some insights on why my children were acting weird?

    Did I get you with the title? :banana: I'm just looking for insight on why my children were acting "weird" for a lack of a better word. UPDATE: 1. The children within question all have the event_inherited(); at the top of each event. 2. I have other children with the same parent and those...
  3. flyinian

    SOLVED How would I get a instance to pass its draw code to a parent and then have that parent send said draw code to all its children?

    I have 1 parent w/ multiple children. I then have one object(obj_DrawCode) that is passing its draw code to the parent. My problem that I am having is that only one child is receiving the draw code. I checked the debugger and it says only one sprite is being drawn. I am trying to draw a...
  4. flyinian

    SOLVED Would I be able to use inheritance w/ enum and ds_grid while having each child have its own?

    I have a parent with enum and ds_grids. I then have multiple children of said parent. In that parent, I have enum and ds_grids created. The enum are used in the grid for clarification instead of the standard numbers. Can each child use the enum and ds_grid created in said parent separately...
  5. samspade

    GMS 2.3+ Bug or not with struct inheritance?

    I think there is a problem with method variable constructors and inheritance, but I'm not sure if this is a bug, intended behavior, or I've made a mistake in my code. The following will work whether it is put in a script asset or an object (so long as you respect scope if its in an object)...
  6. samspade

    GMS 2.3+ Intended or Undocumented Behavior?

    The manual says that: "Structs created [with a constructor] will also support single level inheritance, ie: you can create a struct using a function that inherits the data from another constructor function." This would seem to imply that a struct cannot inherit from a struct that inherits from...
  7. EvanSki

    SOLVED Can scripts have children?

    If a mommy and daddy script love each other very much- no. I want to know if i could make a script act as a parent and have another be a child of that parent script and inherit code. in other languages you could just call that script for a different one or like papyrus you can just have a...
  8. N

    Multiple Inheritance, event_perform_object trick, but with Variable Definitions in 'Parent' objectS?

    OK, forgive me as I am new to GameMaker Studio 2 and the forums so I hope people understand what I am getting at. Firstly, imagine the wonderful Variable Definitions option on Objects did not exist. I had been using event_perform_object 'trick' to pull down clusters of variables from multiple...
  9. muddrox

    Question - IDE Room Editor - Inheritance issues

    So recently I wanted to try out room inheritance to make my project more manageable. I am new to using Game Maker 2 after prying myself away from Game Maker Studio 1.4 but here I am. However, I have found room inheritance to be quite infuriating and it has led me to ask a number of questions...
  10. FacesOfMu

    GMS 2 Inherited variable not getting initialised [SOLVED: IDE bug]

    I've got an object that has this inheritance: par_all obj_item obj_container In the Create event of obj_item, there's // obj_item Create Event event_inherited(); debug_start = 10; In the Create event of obj_container, there's // obj_container Create Event event_inherited(); In the Clean...
  11. M

    GMS 2 How to determine an object's type after upcasting it?

    SOLVED: The problem was that I forgot I had another class that was a child of oAnimal and parent of oCat/oDog. The nearest instance of oAnimal wasn't oCat or oDog, it was oSmallAnimal. So like this: oAnimal -> oSmallAnimal -> oCat/oDog...
  12. abianche

    Physics collisions with "Collision Group" 0 is not working

    Hi everyone, I followed this (old) tutorial for the physics engine: https://www.yoyogames.com/blog/69/physics-in-gamemaker-studio-part-1 If you were to reproduce the tutorial (or just import the project provided at the end of the blog post), the objects won't collide with each other. There...
  13. D

    GMS 2 Testing for child objects

    I could have sworn any time you reference a parent object child objects can count as the parent. Despite that my code isn't working. Does anyone know what i am doing wrong. The code snippet below is from a script which is supposed to accept an inventory object (parent of all inventory objects...
  14. jana

    When to call the inherited event

    I figured out a bug in my code --- it works now, but I don't understand why. Hopefully someone can explain how the inherited event works. I have an object called an orb that has a child, challenger. The challenger often collides with a wanderer, which is also a child of orb. The orbs bounce off...
  15. Kaliam

     Thoughts on new variable definitions, Object linked Scripts?

    Just a friendly suggestion, I was thinking about how events/scripts work in gamemaker, and I thought, what if we could make "Scripts" act like different object events, but also make object events act like scripts. For example, when creating a "draw event" for an object, rather than creating...
  16. M

    Question - Code Problems with inheriting collision code...

    Do objects inherit collision code by default? If so, what's the best way going about and stopping that? Because it appears to me that's how it's behaving. Still working on setting up a better test environment to confirm it.
  17. D

    Legacy GM Script creates new variable instead of referencing existing one

    Hello again. I'm seeing some puzzling behavior when running a script inside a child of a child object. I currently have an object: oActor which is inherited by oEnemy which is inherited by oEnemy1 oEnemy2 oEnemy3 The oEnemy object creates a 2D array in the create event: In each enemy object...
  18. csanyk

    Legacy GM Collision event for Parent and Child

    Let's say I have an obj_parent, and obj_child in my project. Object_child inherits from obj_parent In another object, let's call it obj_collision_tester I create a collision event for object_parent, and define some behaviors there. I then add another collision event for obj_child. I run...
  19. ryo_wufei

    GML [SOLVED] Cannot make an instance of an object inherit variables from another object

    Hello GM community, I'm new at GM and I'm definitely not a programmer so I'm pretty sure I've been missing something obvious here. But after one day trying various tips that I could find on the forums, it seems I cannot fix this myself. I'm currently tweaking the tutorial game that I made...
  20. Curial Lloses

    Question - IDE Issues importing Room assets with inheritance

    Hello, I've seen that importing rooms with parenting options to a project still have some issues and don't know if there's a threat about this. If it is the case, please link me to there. Is there a way to import parent and chindren rooms to a project's resource tree correctly? I've tried...
Top