A
AutoLiMax
Guest
Hi, I'm trying to get an object at the location of a mouse click and then replace it with another object. The new object would be chosen based on what the previous object was.
So far I have this which destroys the object that's clicked and spawns another object in its place:
What I want to do is have an if statement that basically checks what the clicked object is and then decides what object to replace it with.
Something like:
The above is just a thought. As I'm quite new to programming and game maker I'm not sure how I would go about writing it out as actual code.
Any one willing to lend a hand?
Thanks!
So far I have this which destroys the object that's clicked and spawns another object in its place:
Code:
position_destroy (mouse_x-(mouse_x mod 16),mouse_y-(mouse_y mod 16));
instance_create (mouse_x-(mouse_x mod 16),mouse_y-(mouse_y mod 16),obj_dirt);
Something like:
Code:
if clicked object = (obj_grass)
{
instance_create (x,y),obj_dirt;
}
if clicked object = (obj_dirt)
{
instance_create (x,y),obj_farmSoil;
}
Any one willing to lend a hand?
Thanks!