Antoine Farel
Member
Hey everyone,
I got 3 objects:
There is my Step Event for obj_gun_pickup:
The bind_instances and unbind_instances add (or delete respectively) the arg1 to the binded_instance ds_list of the arg2 and vice versa.
The obj_parent_gun is the parent of obj_gun.
In the Begin Step Event of my obj_gun, i use the show_debug_message (to simplify and debug my code) and I show
And this print "-1" but - and that is the point - in the Variables widow of the debugging mode, I see that there is an instance of obj_gun in my binded_instances ds_list of my instance of obj_player.
I really do not understand, my code and debug "contradict each other".
I got 3 objects:
- obj_gun
- obj_player
- obj_gun_pickup
There is my Step Event for obj_gun_pickup:
Code:
with (obj_player)
{
if place_meeting(x, y, other) && key_action
{
var that_player = instance_nearest(x, y, obj_player);
var that_gun = instance_nearest(x, y, obj_parent_gun);
unbind_instances(that_player, that_gun);
instance_destroy(that_gun);
instance_create_layer(x, y, "Gun", obj_semiauto);
bind_instances(that_player, instance_nearest(x, y, obj_gun));
}
}
The obj_parent_gun is the parent of obj_gun.
In the Begin Step Event of my obj_gun, i use the show_debug_message (to simplify and debug my code) and I show
Code:
string(ds_list_find_index(binded_instances, obj_player))
I really do not understand, my code and debug "contradict each other".