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

Legacy GM Script is destroying additional objects

E

Edgar Torres

Guest
I have this sort of "piano tiles" mechanic where objects are randomly generated in 4 possible positions and drop as you tap and detroy the lowest object. However, when a series of objects are generated in the same line, one after the other, whe destroying the bottom-most object, it also destroys all the other objects in the series.
Can you help me detect why this is happening?

[/url]hosting imagenes[/IMG]


This is the script giving me trouble:

Code:
if (!place_meeting(100,1200,obj_nail)&&
    !place_meeting(300,1200,obj_nail)&&
    !place_meeting(500,1200,obj_nail)&&
    !place_meeting(700,1200,obj_nail))
{
    with(obj_nail)
    {
        y += 200;
    }
    script_execute(scr_create_nail);
}
This is what goes on when the object gets clicked on:

Code:
if (y = 1200)
{
    score ++;
    instance_destroy();
    script_execute (scr_check_nail);
}
And this is the other script mentioned:
Code:
randomize();

lanex_0 = 100;
lanex_1 = 300;
lanex_2 = 500;
lanex_3 = 700;

lane_pos = choose(lanex_0,lanex_1,lanex_2,lanex_3)

obj_new_nail = instance_create(lane_pos, global.nail_y, obj_nail);
Thank you!
 

TheouAegis

Member
Where are you destroying the objects when clicked on or whatever? I see where you destroy the nail if it just falls too far.
 
E

Edgar Torres

Guest
Where are you destroying the objects when clicked on or whatever? I see where you destroy the nail if it just falls too far.
if (y = 1200)
{
score ++;
instance_destroy();
script_execute (scr_check_nail);
}
This script is in the Left Button event of the nail. The Y verification allows only the bottom row nails to be destroyed.
 

TheouAegis

Member
When you say all in a line get destroyed, do you mean

X X X X << all destroyed

or

X
X
X
^ all destroyed

? If it's the first one, I'd say make sure you are using just the normal mouse event and not the global mouse event. The normal mouse events are for clicking ON the instance. The global mouse events are for clicking anywhere in the game window. The functions mouse_check_button* are global mouse events, so if you're using those, they won't work on their own.

Also make sure if you are using the normal mouse events that you have the target set to SELF.
 
Top