Platform Builder Forums

Help and Support => Working with Platform Builder => Topic started by: Wizard Indie Games on July 03, 2020, 09:33:26 AM

Title: Distance Check
Post by: Wizard Indie Games on July 03, 2020, 09:33:26 AM
Is it possible to check the distance between the player and an enemy?  I want the enemy to detonate himself when he is close enough to the player.
Title: Re: Distance Check
Post by: TingThing on July 05, 2020, 11:44:24 PM
Yeah, that's possible.


In the character settings, set death to detonate. And then in the looping command prompt, put this:


Code: [Select]
if distance to character 1 < 50
kill enemy


Change "1" to the character ID for your main character.
Change "50" to your desired distance.


I just noticed that "if distance to" is not in the list of conditionals on the website. I'll fix that...
Title: Re: Distance Check
Post by: Wizard Indie Games on July 06, 2020, 08:01:36 AM
Cool. Thanks very much!