• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

with

  1. 2

    Legacy GM Find All Colliding Objs Efficiently (in GM8 Without instance_place_list)

    I want to efficiently check for every collision occurring between the Player and Walls to get the Wall the Player should be up against (the one they actually hit that would push them backward the most from the direction they're going). Normally I'd use instance_place_list, but I want it to work...
  2. 2

    GML Get Lowest, 2nd Lowest, 3rd, ect. of id of Specific Object in Room

    I want to be able to display some test variables from objects that all share one parent object. Right now all instances display their values at once over each other. I need to get the lowest id of existing instances of that object, and if I press "H" on the keyboard repeatedly I need the 2nd...
  3. Rafael Augusto

    Windows distance_to_object in the left or right side of the player

    I need a get right or left side of distance_to_object(Pak). For example if distance_to_object(Pak) < 80 only in the left side of the player. (distance_to_object(Pak) < x - 80) // ?????
  4. Gunnar the Clovis

    SOLVED [SOLVED] Passing object_index to function instead of one instance / Making functions work like with (kinda)

    Howdy, I assumed this would be an easy issue / have tons of similar threads on it already, but I can't seem to find any. What I'm trying to do I thought would be very simple, but it's proving to be troubling for me. Hopefully I'm just being stupid and there is an easy solution: I want to...
  5. D

    SOLVED Help with "with statements" and instances

    Hello! I've been struggling a bit on understanding how to manipulate and instance objects on multiple instances of my enemies. Basically i'm trying to create a secondary collision mask that follows them locked to their x, y. if (!instance_exists(obj_M_Collider)) {...
  6. E

    Same object, different messages

    Hello, in the game I'm creating, the player goes in a bedroom where a lot of papers are pinned on the wall, and everyone has a different message written on it. In order to do that, I only created 4 objects, for the 4 sprites (4 different types of papers pinned, to have some variation), but i...
  7. 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...
  8. K

    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...
  9. K

    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...
  10. 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...
  11. E

    GameMaker [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...
  12. 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...
  13. 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...
  14. E

    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...
  15. 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)...
  16. KPJ

    GameMaker 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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.
Top