1. Qlak

    GML [SOLVED] Lengthdir Problem - Elements not moving properly in circle. X and Y don't match Sprite Origin.

    Hello! I'm having trouble with (probably) lengthdir. I spent so much time on it, but I just can't figure out what I am doing wrong. I thought that maybe someone can give me the reason this is happening. Basically I was trying to draw circles in front of the character, as hands and I used...
  2. M

    GMS 2 Collision avoidance with lengthdir help

    Hello everyone, I have been making steady progress on a game I have been working on (mostly to learn) but it is an RTS style game. Most of the time I am able to debug enough to resolve my own issues, however, I am coming across a problem I cannot seem to think through on my own. Perhaps its...
  3. J

    GML spawning a bullet while rotating

    when my player is at angles 0, 90, 180 or 270 the bullets look correct. if my player is between those angles then the bullet spawns off to the right/left of where it should be. var _xx = x + lengthdir_x(20, image_angle); var _yy = y + lengthdir_y(0, image_angle)...
  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. jb skaggs

    GMS 2 obj moves towards player then orbits it?

    Hi, my question in GML: I want to have an object orbit or swarm around the player object once it reaches it. My hangup is after the collision occurs would I then just use lengthdir to create the orbit? Or is there a simpler way? JB
  6. Zack

    GMS 2 Creating a vibrant sunburst (radial pinwheel) effect

    GM Version: GameMaker Studio 2 (GameMaker Studio 1.4 with slight code modification addressed) Target Platform: All Download: https://github.com/zbanack/TSE-sunburst/archive/master.zip Summary: I walk you through all the steps of creating a stunning sunburst (radial pinwheel) effect in...
  7. C

    lengthdir malformed with statement

    i even used the code from the manual and it doesnt work /// randomly shoot can_shoot -= 1; event_inherited(); xoffset = x + lengthdir_x(5, obj_rotTurret.image_angle) yoffset = y + lengthdir_y(5, obj_rotTurret.image_angle) //xoffset = x + cos(image_angle * pi / 180) * 5 //yoffset = y +...
  8. jb skaggs

    GMS 2 <solved> what is best usage of lengthdir?

    OK I have trying to use lengthdir, for attaching parts to an object and keeping them in place when I rotate the object. I thought I had this figured out. Until I began to try and align the objects and I found that the lengthdir code I have changes the x,y of the initial starting place as soon...
  9. jujubs

    GML [SOLVED] Shooting diagonally with collision_line

    Hi everyone. So I've been struggling with this for the last few hours, and after failing to find a solution elsewhere, I've decided to ask here: how do I check a collision with collision_line in other directions? Cardinal directions are easy, because it uses a rectangle, but I can't find a way...
  10. W

    GML [SOLVED] Help with create_instance_layer and bullet spawn point (lengthdir issues probably)

    Hello guys, first timer here :) I'm trying to solve my issue by myself for a while now, but can't figure it out. Not enough experience yet. So, basically I have a sprite from OpenGameArt. My pivot point is in the middle of the baseball cap of that character. I've also "moved" all frames I need...
  11. Necromedes

    Swinging With Lengthdir_x, etc..

    I want to make the player swing from a fixed object. I have lengthdir set up and can make them rotate around it using the D and A keys but would like to add a form of physics to the whole system. i,e: Add the speed that they're travelling in a direction to when the grab onto the object and use...
  12. Nathan Laing

    Legacy GM [SOLVED] Rotation with lengthdir, origin, one instance

    G'day G'day! I'm trying to rotate an object's sprite around its sprite origin (which I have set to be at the center of the sprite), but after I have first re-positioned it with lengthdir. The sprite is drawn correctly at the new location with the lengthdir functions, but the point (axis?) of...
  13. G

    Locking an object to another based on its image_angle

    Hello, I'm trying to have an object 'locked' to another, so when the primary object rotates the secondary object will rotate around it at a fixed distance away from the primary. For example a rocket booster on the back of a ship. As the ship rotates the booster always stays at the back of the...
  14. J

    Using lengthdir to lock object to another

    I have two objects (Wagon and Turret) and I want the turret attached to the wagon. I found out that lengthdir is the one to use for this. But I'm no programmer/scripter so who can help me out step for step.
  15. Strakee

    Legacy GM View via lengthdir

    Hi, so I've been trying to make an object_view be in the half of the distance between my object player and the nearest enemy so I can have more dynamic views. If solved I will do a max distance but that I can figure out myself. Here's my code and it just simply doesn't work as intended on...
  16. 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...
  17. D

    [ RESOLVED ] Using Particle Emitter with length_dir ??

    Does anyone know how to get the x,y, of a particle burst to follow the tip of a gun. I've used this in multiple scenarios with instances, but this is the first time with particles. I've posted what I think is the relevant code below. The x,y length_dir code I'm using shoots the flame from the...
  18. Nathan Laing

    Legacy GM [SOLVED] Math for (relative) sprite rotation/repositioning

    Hello all! Would a math-wiz lend some help please? <IMAGE BELOW> http://postimg.org/image/mwse7icdz/ Rotating SPRITE A with image_angle, and need SPRITE B to rotate with the same angle--no problem here, but repositioning as in the supplied image... how would one go about that? I suspect some...