lengthdir_x/y

  1. thejosving

    Legacy GM A little help with directions and follow x-y coordinates?

    So i have this dog object, wich follows the player to the x and y coordinates from behind the player, and then change his state to the one that will make he follow the player behind. But the problem is, I can't find exactly what code I should use to identify when the dog is in those x and y...
  2. Ratsha

    GMS 2 Shooting from tip of the gun

    GM Version: GMS2 Target Platform: ALL Download: N/A Links: N/A Summary: How to find the position of the end of the gun's barrel in a top-down shooter. Tutorial:
  3. B

    Help with lengthdir and moving grid

    I trying to make a grid that rotates and moves with the object and is always centered at x,y of the object. Because the grid is dynamic ie can change size it's posing to be difficulkt to program. It needs to be this way rather than a sprite. Is there anyone who can help me? I've got the first...
  4. darijs1

    Legacy GM Lengthdir_x and y problem.

    ive tried a lot of things here, but i couldnt figure it out. im trying to have a wx and wy follow my car at a certain position with the old lengthdir method, but it only seems to get more and more out of place, the more i keep trying. currently im using: step event in car: wx = x +...
  5. W

    [solved]Multi Object rotation

    So I've used this method of rotating objects successfully before but that was only with 1 object. If I try to use this with more than 1 they rotate in the same place all mashed together. How would I go about making multiple objects rotate around one object but stay away from eachother in a fixed...
  6. E

    Legacy GM Follow other object

    I want to have one object (obj_car) follow another object from one end to the other (obj_road). -The car should be able to go each way -Taking a path over multiple roads is beyond the scope -The code should run in the car object -The road object should remain static (no checks or updates)...
  7. S

    Weird lengthdir problem

    I try to create a gun in my game that draws a line to the player, but when this line collides with a wall between the player and the gun the line should only be drawn to the wall. My code is the following: Create event: dir = 0 //direction the gun is facing collide = "" //Variable to store...
  8. P

    GML Dynamic Camera code explanation

    I've been following Shaun Spalding's tutorials. One of his videos mentioned a code for something he called a dynamic camera. The code was following: var xTo, yTo; move_towards_point(mouse_x, mouse_y, 0); xTo = obj_player.x + lengthdir_x(min(256, distance_to_point(mouse_x, mouse_y))...
  9. D

    Legacy GM help image_angle gun problem

    Hey, I am trying to add a fire animation at the tip of my gun. for this I am using an instance_create in the step event when the gun fires and used length_dir so I could measure the tip of the gun from the origin... (Gun origin was 8,14. Gun tip was 26,5... Difference brings me to 18,9). My...
  10. E

    [SOLVED] lengthdir_x/y equation?

    Hello, I'm trying to debug my game and have a problem involving lengthdir_x/y. I believe that knowing the actual equation for lengthdir_x/y would allow me to solve it. I have google searched but can only come up with basic trigonometric equations that don't relate to grid references. Thank you...
Top