Jump to content


Photo

Geiger counter


  • Please log in to reply
4 replies to this topic

#1 Joecoolhair

Joecoolhair

    GMC Member

  • GMC Member
  • 310 posts

Posted 22 February 2012 - 10:43 PM

How can I make numbers increase according to distance to a radiation_object.
:GM8:
draw_text(view_xview+5,view_yview+5,global.radiation_level_machinegun)

Edited by Joecoolhair, 23 February 2012 - 04:09 AM.

  • 0

#2 WyldEyeStudios

WyldEyeStudios

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 22 February 2012 - 11:17 PM

use the distance_to_object GML code.

variable=distance_to_object(obj_player)

Hope that was enough.
  • 0

#3 Joecoolhair

Joecoolhair

    GMC Member

  • GMC Member
  • 310 posts

Posted 23 February 2012 - 01:59 AM

use the distance_to_object GML code.

variable=distance_to_object(obj_player)

Hope that was enough.


Actually I want the numbers to increase when the player moving towards the object.

Example 300 would be normal background radiation, if player come within 1000 pixels of the radiation_object the number increases, the closer to the object higher the number goes up, when player is over object the number would be Max 500,000.

Edited by Joecoolhair, 23 February 2012 - 02:00 AM.

  • 0

#4 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • Retired Staff
  • 9259 posts
  • Version:Unknown

Posted 23 February 2012 - 02:05 AM

Which is what he gave you. Just add the distance (or some mathematical function of the distance) to the value...for example, add 1/distance to the variable and the closer you are, the faster it will count up.

-IMP
  • 0

#5 Joecoolhair

Joecoolhair

    GMC Member

  • GMC Member
  • 310 posts

Posted 23 February 2012 - 04:02 AM

Which is what he gave you. Just add the distance (or some mathematical function of the distance) to the value...for example, add 1/distance to the variable and the closer you are, the faster it will count up.

-IMP

I did it. ::lmao::
Create: global.variable=0
Step: global.variable=1/distance_to_object(radiation_object)
Thanks for all the help. :yes:

Edited by Joecoolhair, 23 February 2012 - 04:09 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users