instance

  1. IcyZ1ne

    GMS 2 How to set variables for clones of the same object?

    So I am working on a fighting game, and in it (of course) I want to have two players to fight against eachother. The problem is that I have 2 instances of the same object and they both use the same controls. How do I make them have separate "moves"? (I would give some code but I have no clue on...
  2. Suzaku

    GMS 2 How to apply code to only the first instance of an object?

    I have a character object in a room and a copy of the same object in the same room. When I move him to the sides both the original and the copy move together. In that case I would like to move only the first instance, not the second one. How do I make my code to apply only to the first instance...
  3. oldnoob

    [SOLVED] Help with destroying an instance

    Hello there, Platformer question: I'm having trouble destroying an instance of an object my player is sanding on.The sprite connected to the obj_blockcollapse has 9 frames of animation and the object's create event sets both the image_index and image_speed to 0. The code in my player's step...
  4. P

    GMS 2 [SOLVED] One of my objects suddenly is unable to find the instance of another

    I have a "player" object and a platform it can stand on, and when it does, said platform falls downwards. In order to make the player stick to the falling ground as it falls, it has to instantly go at the same speed (be moved down the same amount of pixels each frame) as the platform. This is...
  5. H

    GML select an instance with its ID ?

    Hello Imagine that I have a variable containing an ID (integer) like : myid = other.id; But that's not really the question, I would like to know if there was any way to do something like this: with(myid) { ... } instead of with(other) { ... } Is it possible ? Is it possible to use the...
  6. jf_knight

    Legacy GM Simultaneous instance create

    I'm trying to implement a hit-scan shotgun. Every instance... instance_create(x+lengthdir_x(length,direction ),y+lengthdir_y(length,direction ),projectile) ...creates one "hit-scan line". I would like to use 5 or 6 at once, however an instance is created one after another and not at the same...
  7. XirmiX

    GML [SOLVED] Assign code to just-created instance BEFORE it runs its create event?

    I've found trouble doing this. It essentially boils down to having the create event code from the object be placed inside the object/script that creates it. The "with" variable does not help at all, wish it did, seems redundant otherwise. What happens is: Object creates an instance of another...
  8. T

    GMS 2 Instance Order In Layers is Glitched

    Since updating to runtime v2.2.1.287 I've noticed somthing strange. (it also happens in 291..) when deactivating/activating instances, they go back to the layer they were depending on their Creation Order! instead of their order inside the layer, and I've found no way to control it. example...
  9. M

    Check the value of a variable in a specific instance

    Hi there! After reading a lot of thread about similar problem I still can't figure it out how can I check a value of a specific instance and do an action. That's my code. It works but it's always goes to Option room and never in Atrio room. if mouse_check_button_pressed(mb_left) {...
  10. Krenzathal77

    Windows Find ID of creating instance by created instance

    What's the best way for an instance/object to reference the instance that created it and then store that as a variable, but without doing it via checking for a collision or which one is nearest? I have an enemy instance which creates an instance of a hit object and I want it to follow the enemy...
  11. Spongyoshi

    Instance's Variables gets reset without a reason

    Hello everyone! I have checked all the instances related to this particular one but I couldn't find anything. It works fine (it's has important configuration variables like "Which character you picked" or "Which event you're playing", etc..) but when it goes to a special room, all it's variables...
  12. G

    GMS 2 Getting the names of the objects of all instances in a layer?

    I'm trying to iterate through layers and then all the elements in each layer and print out the names. I figured out how to do this for sprites but not for instances The short version is I call object_get_name but I'm guessing I need to do something else. var __inst =...
  13. MartinK12

    GML [SOLVED] How can I use object name in switch statement?

    I've created this simple code and depending what kind of object is selected I want to perform different actions on it, but looks like I always get default case. I don’t know where I messed up? Thank You for pointing my mistake :) if mouse_check_button_pressed(mb_left) { instance =...
  14. FlatulenzaFiamm

    Drag And Drop Create Instance

    Hi everyone! Id like to create an object via the Create_Instance, but only one. Because using the Step Event, the object created is more than one. There is a way I could create just one? Thanks again! :D
  15. G

    Legacy GM Instance variable logic problem

    Ok is very simple, I have an object with this in create event: acc_y = -8; and this in the step event: if (acc_y < 12) { acc_y +0,25} y = y + acc_y; Now i thought that the istances of the object didn't share the internal variables. When I spawn one moster his speed will be like +5, but if i...
  16. O

    Delete certain instances of an object?

    I was wondering how I can delete certain instances of an object. I created a wall object, and I wanted it to be deleted whenever my character opens up the menu, (scr_menu), and selects delete (or case 0 from that script). I was wondering if it was possible to do this after placing the tiles in...
  17. Jmarlin3

    Issues with instances and if statements

    So the player object is supposed to cross over a floor object, with the floor object switching to a red floor object. If the player object is not touching the red floor object anymore, the red floor object dissapears and turns into a wall object, meaning they can't go back.the Here's the code...
  18. jf_knight

    Legacy GM [solved]"Unable to find any instance for object index..."

    I received the following error I'm working on an "aim/view" system that extends the view of the camera in relation to where the player is facing and if the player presses the aim key (aim_key = gamepad_button_check(0, gp_shoulderlb)) (if the player is facing left, the camera moves vertically...
  19. S

    Instance_change animations problem

    hello. So i have my guy standing with his standing animation. then when i press 'T' i want him to attack using the following: instance_change(obj_player_hit, false); But when the instance changes, the animation doesn't start from the first frame. It starts from the frame of the previous...
  20. Cloaked Games

    GMS 2 [SOLVED] Manually Setting Layer for Instance

    Hi, there's a GMS2 bug which I am dealing with here. https://bugs.yoyogames.com/view.php?id=27963. Here is the thread where this originated from. It's a year old so you can imagine I'm a bit peeved that it still hasn't been fixed either...
Top