I don't know what you mean by this. Post code examples and try to be more descriptive of what you mean.in gms1 and before you can call a instance from a step event and it only loops it once.
Did you know that Step and Draw events are called every frame? Try reading the manual.now in gms2 when you draw a instance from a step or draw event it loops and makes loads.
I also am not sure what you mean and the above code looks like a bad idea. It will do the following if soandso == 1 for every view active it will create object2. Object two will then increment its own random_var by 1. It will only do so once. Unless random_var is global in which case that is a bad naming convention.i cant use gms1 anymore as its no longer free and the steam one i do have crashes even after a new install.. im now using gms2 mobile.. the best way to put it is this:
object1..
in DRAW event:
if soandso == 1
{
instance_create(x,y,object2)
}
================================
object2..
in CREATE event:
{
ramdom_var += 1
}
so basically the "random_var" will increase FAST in a create event. sorry if its hard to understand its the best way i can explain it to you
EDIT: just saw the above post.. yes i do know they are drawn every frame but not in create event if the instance is just sitting in a room after being drawn?
"Try reading the manual" please show me where it is in the manual so i can read it because i clearly missed something here? lol
I guess something like instance.? instance.x; instance.y; instance.image_index; instance.random_var;....ah i do use global. alot how else can i get a variable from one instance to work in another?
still iv no idea how that will stop it looping from a step or draw event?I guess something like instance.? instance.x; instance.y; instance.image_index; instance.random_var;....
if soandso == 1
{
instance_create(x,y,object2)
soandso = 0 // or any except 1
}
hmm thats an idea, set it back to 0 when its been called, ill try that in the future.@DaDonMike Did you want to create the object2 once? Then change the soandso to any numbers except 1 will stop it. Something like this:
Code:if soandso == 1 { instance_create(x,y,object2) soandso = 0 // or any except 1 }
If you need to run specific code in a specific order. You need to do it different in GMS2. The step events will run in an order you can't predict.but some code i do has to be in draw event and other code has to be called after that code
// run step code in all obj_prepare_aim
with obj_prepare_aim
{
new_angle=direction+90;
}
// run code in rifle
with obj_rifle
{
if obj_prepare_aim.new_angle>180 allow_fire=true
}
// run code in player fire code
with obj_player
{
if fire_button
{
with instance_create_depth(...) direction=obj_prepare_aim.new_angle
}
}
If you need to run specific code in a specific order. You need to do it different in GMS2. The step events will run in an order you can't predict.
Ex: If you have 3 instances and all use the step event. These 3 can run:
instance 1, instance 2, instance 3
next step
instance 3, instance 2, instance 1
next step
instance 2, instance 1, instance 3
...
Even if you have it on different depths or layers or anything. This is how GMS2 do step events. Yes, you could do it different in GMS1.4 in some cases, but not in GMS2. So you need to forget everything you learned in GMS1.4 about step order and the depth variable.
If you need to run specific code before other code run. Use a controller:
Ex:
But in general it's a bad idea to code this way. Best is to code it in a way you don't need to run specific code before other code. Or al least limit it so you only need to do this in some cases.Code:// run step code in all obj_prepare_aim with obj_prepare_aim { new_angle=direction+90; } // run code in rifle with obj_rifle { if obj_prepare_aim.new_angle>180 allow_fire=true } // run code in player fire code with obj_player { if fire_button { with instance_create_depth(...) direction=obj_prepare_aim.new_angle } }