The Daily Click ::. Forums ::. Klik Coding Help ::. proximity mine
 

Post Reply  Post Oekaki 
 

Posted By Message

badm1nton



Registered
  01/02/2009
Points
  14
5th April, 2009 at 03:33:28 -

i have this proximity mine, i'd like to activate, when the player gets close, but i can't seem to figure out, how to define the range.
would like it to activate, when the players position, is within 100 pixel of the mine in any direction.

does anyone know how this could be achieved?



 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
5th April, 2009 at 03:58:36 -

For the conditions, use the properties of the MINE object, not the player, and not the "compare 2 general values":

+Position X of "Mine" is Less Than or Equal to Position X("Player") + 100
+Position X of "Mine" is Greater Than or Equal to Position X("Player") - 100
= Explode Mine
= Hurt Player

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Mr G



Registered
  31/12/2008
Points
  178

VIP MemberPS3 OwnerI like Aliens!Attention GetterDos Rules!
5th April, 2009 at 10:34:40 -

Or simply make an invisible active 100pixels away from the mine and when the player clashes with it activate it

 
Image

http://create-games.com/project.asp?id=1549

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
5th April, 2009 at 11:58:26 -

Pixelthiefs solution is nice and simple, but the detection range is a box, not a radius.
If you use MrGreens solution and have multiple mines, you may have problems trying to figure out which mine goes with which detector.

I'd suggest:

+ Always
-> set Range("Mine") to ((X("Mine") - X("Player")) POW 2) + ((Y("Mine") - Y("Player")) POW 2)

+ If Range("Mine") < 10000
-> detonate Mine

 
n/a

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
5th April, 2009 at 18:23:09 -

Damnit Sketchy you keep beating me to the answer!

 
thinking is like pong, it's easy, but you miss sometimes.

badm1nton



Registered
  01/02/2009
Points
  14
6th April, 2009 at 09:43:11 -

thanks everyone, went with Sketchy's solution, works like a dream

Edited by badm1nton

 
n/a
   

Post Reply



 



Advertisement

Worth A Click