K
KieranSherman
Guest
Hey everyone,
I think I know the answer to this, and I think that answer is no but is there a way to create a new variable within an object outside of its create event?
I'm trying to make my code as easy as possible, and basically what I'm doing is creating an object (called oTile) which in its create event, creates a variable (called attributeMapObject), and initializes it with the create call to another object (called oAttributeMap).
Create Event of oTile
createAttributeMap
Ideally I wouldn't have to do this, and I could get away with doing something like this:
Create Event of oTile
createAttributeMap
I'm mainly trying to do this because of naming. I have a bunch of functions that are responsible for manipulating maps, and they will work with any object passed into the function, as long as the object has a variable named attributeMapObject and that variable is assigned to an oAttributeMap instance. I know I could do what I'm trying to do with inheritance and parenting and whatnot, but I was just curious if there's any other way to do it.
Thank you!
I think I know the answer to this, and I think that answer is no but is there a way to create a new variable within an object outside of its create event?
I'm trying to make my code as easy as possible, and basically what I'm doing is creating an object (called oTile) which in its create event, creates a variable (called attributeMapObject), and initializes it with the create call to another object (called oAttributeMap).
Create Event of oTile
Code:
attributeMapObject = createAttributeMap();
Code:
var instance = instance_create_depth(0, 0, 0, oAttributeMap);
return instance;
Ideally I wouldn't have to do this, and I could get away with doing something like this:
Create Event of oTile
Code:
createAttributeMap(self);
Code:
/// @param object
var object = argument[0];
var instance = instance_create_depth(0, 0, 0, oAttributeMap);
//creating the new variable without it being previously defined
object.attributeMapObject = instance;
I'm mainly trying to do this because of naming. I have a bunch of functions that are responsible for manipulating maps, and they will work with any object passed into the function, as long as the object has a variable named attributeMapObject and that variable is assigned to an oAttributeMap instance. I know I could do what I'm trying to do with inheritance and parenting and whatnot, but I was just curious if there's any other way to do it.
Thank you!