instance

  1. W

    Discussion Persistent layers

    What's is the best way to deal with layers and persistent objects in GMS2? I've found when moving a persistent object to a new room it's layer don't follow. My solution in testing has been to find a suitable new layer, moving the object in the room start event. The objects in question for me...
  2. S

    GML Check for object like "with obj.var"

    Hi all So I've been starting to create an AI, that should be able to have "teams". Every object, that uses the AI, contains a "team" variable. What I want to do now is to check for instances that contain the variable "team", and if this variable isn't the same as the checking instances "team"...
  3. M

    Multiple instance for multiple instance

    Hello Hello! So the thing i got a hard time to deal with is; I made an enemy tank who have a turret. I made a spawn point but there is only one who have a turret. I know my problem witch is that the turret spawn on "obj_enn_tank1" but then when an other "tank" spawn, the turret is already...
  4. Ayziak

    GMS 2 [SOLVED] Deactivating instances when hidden...

    So in my game, I have an object as part of my lighting engine that is rather CPU intensive. Whenever I have more than 3 in active at any point, my game drops from about 500fps to 40 (my game runs at 60). I've already made it so that when instances of this object are outside of the view, they are...
  5. zendraw

    Legacy GM Q:Instance_deactivate/activate and timelines

    how does instance deactivate affect a timeline that is dynamically created with timeline_add? yestarday as i was testing i wuld set a timeline to destroy the a instance i dont want, also as theplayer moves he activates/deactivates an area around him but one instance didnt get destroyed for some...
  6. gnysek

    Discussion [Proposal] named instances info getting

    Since GM:S 1.x and in GMS2 too, we can set name for instances placed in room editor. As they were numbered from 1000000 up in pre-GMS, they now are usually named "inst_XXXXX" where XXXX is a hex number. Later on, you can use this variable inside code, since in fact inst_XXXX constant is just an...
  7. D

    Help with Code - Collision

    As an assignment for class, we are creating a game using GM Studio and for a certain part I am required to figure out something with code but I'm really confused and the teacher won't help. Please if anyone can help The object of the game is to have a ball hit a goal to score and win, but it's...
  8. Wuzzems

    Legacy GM [SOLVED] Specific Instance Burst Emitter Checking

    I currently have my particle system,type,emitter etc setup within a script (Particle_1) which I call upon when obj_small is in the vicinity of obj_ship and the player has pressed space. All of the obj_small instances are moving to the left if !place_empty(x,y) &&...
  9. Enagic

    Question - Code Instance_place() not working as before?

    Hi there! I'm really confused with this. I imported my GMS1.4 project into GMS2 and it works perfectly. But since I didn't have much progress and I wanted to get used to the new program, I started it again on GMS2. Until know, everything perfect, but the problem came when trying to work with...
  10. U

    object_index could not find instance

    I am trying to simplify dealing damage by having a generic hitbox determine what to damage based on the instance's parent. // outside information target_group = object_parent.object_index; // inside collision with parent if(other.object_index == target_group) { /* Do stuff */ } However...
  11. SgtMoose

    [SOLVED] Having Trouble Triggering an Event

    Hello Everyone! I am having trouble triggering an event after the final boss of my game is defeated. Basically, what I want to do is display a "BOSS DEFEATED" message after the final boss is defeated. I created a controller called "boss_timing_controller" that looks like this: This...
  12. mar_cuz

    Legacy GM Instance nearest in direction

    Hi Guys, I'm making a top down game and I'm trying fire a projectile at the nearest instance in my current direction only. The instances I'm trying to fire at are different but share the same parent. I'm trying to use the parent as the target so I can just hit the nearest instance in my...
  13. P

    Lvl Created obj spacing issue

    I am writing this from my phone. I need some help on how to create instances upon a random generated level that have a space(about 256 pixels away) between each instance. . like this(focus on the blue/purple x) but that was by luck. this is how most of my rooms look like i want the Xs to be...
  14. RocketTo5

    Specific Instance ID

    Hi, I have a room where if a specific enemy does not exist(it dies), then a key will spawn. But because there are multiple of these same enemies, I am using the instances ID. if !instance_exists(C3ED5ACA) //Enemies ID { instance_create(64,440,obj_key) } I realize this does not work, how would I...
  15. A

    HELP! How do I find an instance with id

    So I used a system to select a unit on a grid that utilizes that tile's id to select it. Now I want to check a variable, 'covered', that is in that object. How then would I do this? I tried instance_find, but I do not believe that is what I need to achieve my goal. Any help would be greatly...
  16. F

    Array Object

    Hi! Can someone tell me if this code is right? I mean if i can get "y" from an object through array. if(nostick==1) { array=instance_create(obj_player.x+75,obj_player.y-75,obj_stick); nostick=0; } if(array.y<150) <-- { array.vspeed=0...
  17. Samuel Venable

    Discussion How many people want instance_create() back?

    In other words, for 1.x project compatibility purposes, there should be a way to make a script named instance_create in the resource tree without it saying "Oops! You are using a deprecated function" error. How many of you want this for convenience? It wouldn't take much work for YYG to remove...
  18. G

    Windows Error related to creating a new instance of an object

    I am trying to simply create an instance of an object but it won't let me. I am not a noob, and this never used to happen. Did it update? ___________________________________________ ############################################################################################ ERROR in action...
  19. O

    Legacy GM How to select specific instance of object

    I have a mechanic of switches opening doors it looks like this: the problem is that on my code i am referencing the door_obj (my door object) so one switch opens all doors, i need one switch to open a specific door, so i have been looking how to select a specific instance on the room i came...
  20. L

    Legacy GM [SOLVED]Access instance's "Creation Code" without room GUI Editor

    Hey, I seem to be missing something glaringly obvious about instances :-/ I have two instances of the same object in my room but they only appear after text input by the user (so I cannot put the instances in via the room GUI Editor or else they'd appear right away). The instances are...
Top