a small problem with instance_place()

F

fxokz

Guest
Code:
var inst =  instance_place(x, y-1, obj_puzzleblock);
if inst != noone
{
    with(inst)
    {
        ignited = true
    }
} else if inst = noone
{
    with(inst)
    {
        ignited = false;
    }
}
The problem is that inst will never be equaled to noone, because of this, once the blocks are = ignited they will stay ignited. How can i make it so that if the block above is not colliding with the object than it is unignited?
 

Bingdom

Googledom
noone actually equals '-4'

Doing with(-4) will not go towards any instance.

If you want to make non-colliding objects to stop igniting, you should run the collision check with obj_puzzleblock instead ;).
 
A

Aura

Guest
Alternatively:

Code:
var inst = instance_place(x, y - 1, obj_puzzleblock);
with (obj_puzzleblock) {
   ignited = false;
   if (inst != noone) {
      if (id == inst) {
         ignited = true;
      }
   }
}
 
Top