• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!


  1. Lens

    SOLVED How to make other objects above an specific one have their events triggered?

    Good morning/afternoon/evening! I'm making a tile-matching game and need pieces to fall once a said line gets completed (removed). Thus, I tried making a if object.y < self.y with(object) triggeringvariable = true; once it turns true, the object gets their ".y += 30". The problem is, instead...
  2. Krenzathal77

    Using "With" to address the draw event of an enemy instinctive from player

    Hi all, Is it possible to change the draw event of an instance using the "with" function? I'm trying to use it to change an enemy's rotation and x-scale from the player object frame by frame during a combat move. All my objects use the draw event so "image_angle" won't work, and the rotation...
  3. Krenzathal77

    Using "with" to store ID of an object's creator in variable (not working)

    Hi folks, I'm having a problem with storing instance IDs. I have multiple instances of an enemy object that can attack the player with punches/kicks etc. These enemies create hit objects which collide with the player, so obviously I want the hit objects to know which instance is creating them...
  4. A

    Legacy GM with (other) not working properly

    I have an projectile and I have an enemy in the enemy's step event I try to make it so that if it touches a projectile it supposed to: -lose a point of health -destroy the instance of the projectile var hit = place_meeting (x,y,obj_player_projectile) if (hit) { enemyhealth -=1; with...
  5. Elgarion

    GMS 2 [Solved] ways to change variable inside an object

    Hello everybody ! I have a question about good practices in programing : when you want to change an object's variable, do you use "with" or "my_object.my_variable" ? the two ways seem to work : with(Obj_Player) { my_variable_health = 10 ; } ; or Obj_Player.my_variable_health = 10; Which...
  6. josyanf1

    GML Different objects in a 'for' loop (SOLVED)

    Hi all! Programming objects that have different directions I thought I could make a for loop to optimize code. I usually do it this way to assign attributes to an object: var particle_1 =instance_create(x,y,obj_firework_particle); with particle_1 {direction = 30}; var particle_2...
  7. P

    Help with "with" to affect all instances of an object.

    Hi everyone, I have an object I call "oLighting" it's an accumulation of code that I've picked up on tutorials and forums, and it creates a light source that affects all my objects under my parent object. It works great, however I'm having troubles with the "with" function, as I already have all...
  8. Edwin

    GML Any ideas how to implement this?

    Hello, people. I have simple fade effect object that creates a black rectangle sized to room's width and height. When it's alpha equals to 1 I need to call a user defined event but with specially modified code. I do not want to create new child objects, so how do I do this? For example like...
  9. Sumbeard

    Windows Game force-closes during save (using 'with')

    So, I've been trying to hunt down a bug where my game will close without an obvious error (whatever 'exited with non-zero status (-1073741819)' means specifically, I couldn't find) I tracked it down to this section. with(all) { var _var_names = variable_instance_get_names(id)...
  10. KPJ

    GMS 2 With statement help (GMS2)

    Hi everyone! I need help with the "with" statement in gms2. I am making a top down game, and I want it to be so that if the player gets in the enemies field of view, the enemy's state will be "alerted". However, I also wanted all other enemies that were within clear view to be "alerted" as well...
  11. K

    Destroy one instance of an object help

    So, my problem is that i wanted to destroy for example a bullet that i created with my keyboard_check(mb_left) and if that bullet hits a wall it destroys itself everything is fine but if there are more than two bullets every bullet gets destroyed. Bullet Step event if (place_meeting(x , y...
  12. Kezarus

    Legacy GM [SOLVED]with statement issue

    Hi! I'm having major problems with the statement "with". I ussualy call it like: with(objPeople){ if( OwnerName != "" ){ //do stuff } } Then, after 2 hours of gameplay or more I get erros like: Those errors happen inside the objects that have no relation with to objPeople...
  13. MartinK12

    GML [SOLVED] What is the order of code execution within WITH construction? What’s going on inside it?

    Take for example this simple code from manual: var inst; inst = noone; with (obj_ball) { if str > other.str inst = id; } if inst != noone target = inst; Is it executed like loop, creating ds_list? So with statement takes each instance of obj_ball in order (probably from low to high...
  14. MartinK12

    GML [SOLVED] Do I need to provide variables used in with(all) code to all objects?

    In example when I use this code: with (all) { clicked = false; } do I need to provide variable clicked to all objects? So far I haven't seen any issues with objects that don't have this variable but I want to make sure if this can break something? Thank You.
  15. E

    Object behavior is all the same.

    This is my object spawner, which I'm currently testing with to help me understand controlling objects better. if alarm[0]==-1 { var inst_1 inst_1 = instance_create_layer(irandom_range(200,1910), 200, layer, obj_Enemy_1); inst_1.speed = choose(1,9); inst_1.image_angle =...
  16. B

    GMS 2 instance_create_layer Problem With "with"

    Hello, I am trying to make a boss with bullethell phases. In my understanding create event triggers before the "with" function to change the variables. How can I solve this?
  17. Dracodino300

    Legacy GM Instance_place_list clarity

    I'm using the premade instance_place_list in my project, but the code seems like it is a little more complicated than it needs to be. I was just wondering if there was a reason for this and I'm misunderstanding exactly how it works. It's a fairly arbitrary change, just wanted to know for my...
  18. Krenzathal77

    Legacy GM "with" command destroying wrong object

    Bit of an odd problem here. I have it so that when my player land on top of an enemy the enemy gets destroyed - sort of similar to how the Mario games work. The issue is that the "with" command is completely destroying the wrong instances, in fact it's destroying every instance of a type of...
  19. N

    Count instances that have a particular variable

    Hi all again, how would I get it, so that I can keep track of the bullets with variable 'personWhoShot' equals to "red". Instance_number(obj_bullet) works fine, but it detects all the bullets. So personWhoShot="blue" too. I tried it with the 'with'-statement, but when a red bullets gets...
  20. Le Slo

    GMS 2 With statement and child objects

    Hello! I've been having troubles I don't really understand with the with statement and object parenting. Here is what I have: -An obj_laser. -An obj_laserAttack (child object of obj_laser). So, I need to save the positions of those objects, and for that I use the following to save the...