• 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!

instance_create

  1. 31Nf4ChZ4H73N

    GameMaker How to prevent overwriting of variables that were applied during instance creation by a Struct in the Create event?

    With the instance_create function I can apply variables from a struct to a new instance before its Create event runs. However, if I have the same variables defined in the Create event of the instance the variables applied via struct will be overwritten. e.g. this is how my create event of my...
  2. Athena's Owl

    Creating objects stored inside of a ds_grid into a large room

    Is there a way to create objects into a room that are stored inside of a ds_grid? Instance_create_layer or depth doesn't like when I try and place a something other than a direct object and gives me an error. I can draw my ds_grid when I have sprites stored in the draw event, but I imagine when...
  3. andev

    Imagine if the create event could take arguments

    Perhaps this is the wrong place for this but I would love to start a discussion, even if it never gets implemented. But yeah, imagine if you could do instance_create(obj, arg0, arg1) etc. And then the create event could look like: x = argument0; y = argument1; Or even if the arguments started...
  4. E

    SOLVED Problems with a code

    Hello, i speak spanish so my english is very bad,i have a problem, i wanna make a shooter game and i cant. Because "instance_create" its variable and not a function. i see tutorials and forums, and they have "instance_create" in orange. Hola, hablo español así que mi ingles es bastante malo...
  5. sinigrimi

    GameMaker [solved]removal from instance_create script if the object was destroyed

    Hello! When I enter the room, it reproduces the blocks, but when I move to the next and return to the first, nothing is reproduced in it :( p.s .: rooms are not from GM but are generated in the same GM Room after moving outside the camera. I would also like to know if I can mark these objects...
  6. S

    HTML5 Intance_create not working

    The instance_create_layer function is not working my code is: if (instance_exists(oPlayer)) && (point_in_circle(oPlayer.x,oPlayer.y,x,y,64)) { nearby = true; if (keyboard_check_pressed(ord("Q"))) && (!instance_exists(oGunPickup)) && (!instance_exists(oGun)) { image_index =...
  7. W

    how do i create a instance

    i am trying to make a top down shooter in gml, i've made all the movement and rotation but i don't know how to make the player shoot, i saw tutorials online and all of them said to use the function "instance_create" but every time i use that it just says it is a variable and it says nowhere that...
  8. Corey

    (Fixed)Global variable/Alarm/instance_create issue

    Edit: Disregard. I fixed my problem by adding a Step event with global.enemyCounter = currentEnemies; to check the counter every frame and switched my Alarm event code to check conditions before spawning an enemy. Hello all. I have tried countless times to fix my problem. I am somewhat...
  9. M

    "Instance_create_depth" bug/annoying thing

    Hey, Recently I've been working on my own boss A.I., but I've encountered an annoying problem. Whenever I try to use the function "instance_create_depth" on my bot, on the first frame the instance that it creates spawns in the wrong coordinates which makes it look bad. I've tried many things to...
  10. Z

    GML Instance_create sometimes works and sometimes doesn't

    Hello, I completed the traffic spawning system in my GTA 2 style game, and it worked, but after a bit it stopped. The way it works is it checks the player distance, and then creates a car, and then a pedestrian in the car to drive it. Problem is, the pedestrian only spawns about 20% of the time...
  11. O

    Instance_create no longer accepts variables

    The code is essentially: (during attack frame) { var damage = instance_create(x,y,obj_damage) damage.creator = id; damage.attack = 5; } (in the damage objects create event) z = creator.z; The game crashes and gives me "<unknown object> <unknown variable> "creator" "z" error
  12. N

    Need Code Help

    Hello GMC, could anybody please help me with something. How do you create an object with variable set to that object say for example if the code below existed: key press Z instance_create_var(x,y,item,var1 = 0 | var2 = 0 | var3= 0) This is the best way I can think to explain it sorry :) Please...
  13. D

    Windows Instance_create does not work in the windows test game, but works perfectly in the HTML5 version

    I made a game with a quick intro, the end of the intro is supposed to create an object I tested this a couple days ago, worked perfectly, no problems in windows or HTML5 Today I made a second room to do some testing, after I finished testing, I deleted that room Now HTML5 spawns objects, but...
  14. H

    Legacy GM instance_create doesn 't work

    I am trying to create a button that when pressed creates a GUI on the side of the room. for the GUI to be interactive, i made buttons (obj_more, obj_less) wich should spawn when the button is pressed. But when I try the code I also used for another button (wich worked) it didn 't work. I also...
  15. C

    Legacy GM [Solved] Moving right to left

    In an alarm[1] event called obj_ufospawner I have the following code: // set the direction of the UFO var ufo_dir = irandom(1); var x_start = 0; // set the x start point var y_start = random(400) + 60; // set the y start point if (ufo_dir == 0) { direction = 0; // go right x_start =...
  16. S

    GameMaker Collisions with 2 objects created with instance_create

    I have hurtbox and hitbox objects that are created around enemies and the player in my game, using instance_create_depth(). And that's fine, for the most part, except that when a hitbox is created, I need some way of registering a collision with the hitbox, and the hurtbox (like a collision...
  17. S

    GameMaker Editting the properties of an object created with instance_create

    I have a hitbox I create in an attack state for the player. Here is my code: bodyHitbox = instance_create_layer(x + 450, y, layer, obj_body_hitbox); object_set_solid(bodyHitbox, true); bodyHitbox.mask_index = spr_player_attack_1_body_hitbox...
  18. csanyk

    Asset - Scripts InstanceCreate

    InstanceCreate is my first Marketplace asset for GMS2. I created it mostly as an exercise to make sure I knew how to create assets for GMS2, and also to "fix" a mild annoyance I have with the instance create functions in GMS2. This is a very simple script for GMS2 users who came from GMS1, and...
  19. E

    instance_create(x, y, obj) without coordinates?

    Is it possible to create object without specifying x and y? The matter is that obj_warrior can be spawned within (x:100, x:200) while obj_archer can be spawned within (x:0, x:100); The available spawn range for each sprite is supplied as their properties (rangeXstart, rangeXend). But I can't...
  20. P

    instance_create Help!

    I was following a space shooter tutorial and in the video they used a code similar to instance_create(room_width+40, randY, Enemy); I found out GameMaker removed instance_create to instance_create_depth or layer but when i tried the new code it says "number of arguments expected 4 got 3. whats...
Top