distance_to_object

  1. xS89Deepx

    GameMaker Sound play at distance

    This code work perfect if i put it in the player's step event - if distance_to_object(obj_dog) < 400, for example i have 2 enemies, dog and cat they both have different sounds. If i put 5 dogs in the room it only play 1 dog bark sound rest of them don't play sounds. obj_dog Step Event - if...
  2. B

    SOLVED Multiple audio listener point

    Hi guys, I tried a very basic sound distance effect. For example, when obj_character moves away from the object_gun that has a gun_sound, sound comes to as low volume. Also moves away more, sound doesn't come. Okay that is working like this. obj_gun (Step Event) if...
  3. Fleoh

    GameMaker [SOLVED] Follow an object with his ID.

    Hello guys ! I'm trying to make an object follow an other object thanks to the ids. In fact, the first instance needs to follow the player, the second instance need to follow the first instance, the third the second [...] So i've tried this code : In create event of the object which needs to...
  4. YamboGames

    How to track movement towards a point

    I want to build a check into my game that triggers, when the Player moves towards an object. I want to compare the previous distance_to_object with the "now" distance_to_object. If the distance got smaller aka the player moved closer to the object, then it shall trigger. How do i manage this...
  5. C

    GameMaker Script to detect distance to object only working with one object.

    hi guys and girls, I am having some issues with a script I have made, Basically I want a space ship to drive up to a planet object and when its inside the diameter of the planet object get smaller (as if to land on the planet) I have got this working correctly if...
  6. J

    [solved] distance_to_object not working

    Title is not 100% accurate but I'm not sure what to call my problem. The distance_to_object is working but it's not working for what I want it to do. I'm trying to create a basic tower defense but I'm having some problems with the distance_to_object function. It seems to have boundaries in a...
  7. M

    GML Program Function Questions...

    Questions 1. Is there a function to figure out the direction to an object without actually pointing to that object? 2. Is there a way for an object to assign a variable to another object when the first object uses instance_create_layer Example: obj_player creates bullets...
  8. Le Slo

    Part type alpha 2

    Hello, I've been playing around with particles for my lasers. I have the following: -3 Particle types (once for the laser beam, another for a different kind of laser (not relevant now) and a last one for the end of the laser (I will call it laser splash from now)). They are global variables...
  9. Y

    Legacy GM point_to_object not working (SOLVED)

    so I'm using point_to_object in this script: if(instance_exists(Obj_Inscriptiontable1)){ if(distance_to_object(Obj_Inscriptiontable1) < 3){ show_debug_message("Close") if(global.Mission[1] = 1 && global.MissionQuest[3] = 1 && global.Inchat != 1){ global.Inchat = 1...
  10. Y

    Legacy GM distance_to_object not working

    So I'm using a dialogue system that's connected to my missions to show certain texts for certain objects at certain missions. first you have mission 1 in mission one you have 4 quests and you need to complete 1 to proceed to the other my first 2 quests work fine but for my 3rd the player needs...
  11. B

    Legacy GM Problem with place_free() [SOLVED]

    I am making a 2D shooter in which there are covers. There are two problems: 1. I am using distance_to_object function to check if the distance between the player and the cover is smaller than N pixels, then check that if 'V' is hold then the player will be covered. However, when I go past the...
  12. Z

    GML Reduce speed when close to an object

    Hello, I want to make an object who moves in a specific speed to other object and begun to slow down until it reaches speed 0 when it is touching or about to touch the other object
  13. P

    distance_to_object() return?

    Hey, First time using a Forum if this is in the wrong folder please tell me :D Can someone tell me what distance_to_object(); returns if there is no object? Thanks in advance
  14. Z

    "distance_to_point"Follow object.x GML and Drag'n Drop

    If I put a question with " if distance_to_point(obj_player.x) is ..." it says to me that something're wrong (Wrong number of arguments to function or script) I want that an object follow the x position of the player with his own speed if you know another way to do it. I'm really don't have any...
  15. M

    distance_to_object - Help Me Understand *SOLVED*

    Hello, I have written a script for my npc's to make them always face the player by using the built in function "point_direction". I am happy with how this works but now I want them only to face the player when he is in a specific range to them. I use "distance_to_object" for this and that also...
Top