Christopher Alexander
Member
Hi,
I need to get either the sprite name of an object which I know the coordinates of, or maybe get the value of a variable instead held within that object. Preferably both. How do I do this?
EDIT:
Instead of a new thread I'm editing this one as my query has changed slightly but is still related to the original post.
I need this code to work:
Basically, I'm making a falling block game, and this code is what I'm trying to use as a "neighbour finder". It is in the parent object of the main game block. It should check the block above it and to the right of it if they are the same kind of block and if so add it's "matched" int with the neighbour and passing the new value to both objects. I've been at this for a couple of hours and I'm pretty tired so I dont know if I missed something or even am understandable.
Please help!
I need to get either the sprite name of an object which I know the coordinates of, or maybe get the value of a variable instead held within that object. Preferably both. How do I do this?
EDIT:
Instead of a new thread I'm editing this one as my query has changed slightly but is still related to the original post.
I need this code to work:
Code:
var objectName = object_get_name(object_index);
show_debug_message("Clicked: " + objectName);
object_above = instance_position(x, y-50, objectName);
object_right = instance_position(x+50, y, objectName);
show_debug_message("Above: " + string(object_get_name(object_above)));
show_debug_message("Right: " + string(object_get_name(object_right)));
if (place_meeting(x, y-50, objectName))
{
show_debug_message("found above");
newMatches = matched + object_above.matched;
matched = newMatches;
object_above.matched = newMatches;
}
if (place_meeting(x+50, y, objectName))
{
show_debug_message("found right");
newMatches = matched + object_right.matched;
matched = newMatches;
object_right.matched = newMatches;
}
Please help!
Last edited: