S
ShampooDance
Guest
Apologies if this has been covered before, I searched this forum and didn't find any topics covering similar issues.
I have an object that approximates the nearest x/y of the mouse along a set path, which rotates around a center point. I want this object to spawn another object, rotate it so it's facing the same direction as the spawner, and set the new object moving in a fixed direction at a set speed. Right now movement is working fine, but spawning the new object is presenting an issue.
My understanding is that I'll need to assign the new object's instance ID to a temporary variable and then set the rotation and movement parameters using Apply To..., in order to avoid changing the rotation/movement of all instances of this object. Here is the logic that I have currently:
At present, this logic throws the following error upon Left Click:
I've tried assigning other names to the temporary variable, and/or initializing the temporary variable prior to the Create Instance command, but neither alleviate the issue. I've compared my implementation to the example given in the manual entry for Create Object Instance and don't see a difference beyond the instructions given after Apply To..., though I'm sure there's something I'm missing.
Any clarification or help anyone is able to provide is much appreciated! GMS2 is my first real attempt at this sort of thing so I'm sure there are a lot of programming best practices that are obvious to knowledgeable folk and totally lost on a novice like myself.
I have an object that approximates the nearest x/y of the mouse along a set path, which rotates around a center point. I want this object to spawn another object, rotate it so it's facing the same direction as the spawner, and set the new object moving in a fixed direction at a set speed. Right now movement is working fine, but spawning the new object is presenting an issue.
My understanding is that I'll need to assign the new object's instance ID to a temporary variable and then set the rotation and movement parameters using Apply To..., in order to avoid changing the rotation/movement of all instances of this object. Here is the logic that I have currently:
At present, this logic throws the following error upon Left Click:
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object obj_blox_spawner:
Variable obj_tblock.<unknown variable>(100003, -2147483648) not set before reading it.
at gml_Object_obj_blox_spawner_Mouse_4 (line 34) - image_angle = block_dir;
}
############################################################################################
Any clarification or help anyone is able to provide is much appreciated! GMS2 is my first real attempt at this sort of thing so I'm sure there are a lot of programming best practices that are obvious to knowledgeable folk and totally lost on a novice like myself.