As of GMS 2.3.4, I don't see anything in the Manual or AutoComplete that suggests
type
is a built-in keyword. If it turns red in your project, chances are you have a resource, macro, or enum in your project already using that name. You would need to use another name.
Also, if you are getting your code from pre-2.3 tutorials and there are errors coming from "unknown" objects, see this:
Symptoms to Look For Expand for screenshot: The error is in the Create Event for object . The subject is with a variable name that's either built-in or known to be already declared. The stack trace shows the source as something starting with gml_GlobalScript. For Question Askers You are...
forum.yoyogames.com
Also, given that you are trying to reference
obj_tile.type
, you also need to read this article:
What's the difference: Objects and Instances GM Version: N/A Target Platform: All Download: N/A Links: N/A Introduction At least a dozen times a week, I see questions on the Q&A section that have to do with people not distinguishing objects from instances. This topic aims to explain the...
forum.yoyogames.com
NEVER access a single instance by object ID if multiple instances of the object exist. This includes attempts to reference or set object.variable (which is inconsistent across exports) and using with (object) to apply actions to it (this encompasses all instances of the object instead of just the one you want). Verbally, "Dog's colour" makes sense with one dog, but not with multiple dogs.
Corollary: NEVER set or use an instance's own variables with object.variable. An instance's own variables can be referenced as-is without dot prefixes. DO NOT use self. If multiple instances of the object exists, you might end up setting the value for all instances or for some other instance (depending on the export).