• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Deleting instance at known location

L

ladlon

Guest
Hello. So, I just wanted to make sure this is the right way to do this....

I have a routine that is placing instances on the screen at various (known) locations (...32 pixel 'tile' blocks at regular distances from each other).

I then have a routine that will remove some of those blocks.

I do not know the ID of each of the blocks (as they are created dynamically, at a point earlier in the code), but I do know the location of the blocks I wish to delete.

So, I figure I use the instance_position command to get the ID of the block/instance at that (known) position.

And then, I use the newly aquired ID value to destroy the instance? But, I'd have to use a 'with' command, because it's my 'main loop' that is containing the code (and not the target object)? (The code is all in a script that is called by the room item)

Could someone type out the code for that, just so I can be sure I have it right?
 

rIKmAN

Member
Could someone type out the code for that, just so I can be sure I have it right?
It'd be a better learning exercise for you if you attempted to type it out yourself first and posted it (use code tags).
Others could correct anything that may be wrong and explain what changes need to made to the code you wrote, if any.
 

FrostyCat

Redemption Seeker
The Manual entry on instance_position() has an example on how it's used. If you have so little initiative that you can't adapt the example to work with a simple instance_destroy(), you should move onto something else that doesn't require independent thought.

Handing everything off to strangers online and not reading documentation aren't part of being new, they're part of being negligent.
 
Top