weird ?angle problem with draw step (blurred/transparent copy on mirrored angle)

Discussion in 'Programming' started by p4stoboy, Jan 13, 2020 at 11:55 AM.

  1. p4stoboy

    p4stoboy Member

    Joined:
    Nov 6, 2018
    Posts:
    17
    Instead of drawing once correctly it is drawing two of each segment on like a 20 degree angle adjacent to each other (the V shape which is more prominent the slower the segment is moving).

    It's like the b position vector changes every other frame. It's definitely something to do with me updating that because it's the bvector end of the object that is shifting. I just don't understand how; the angle doesn't change value when the segment isn't moving.

    Edit - although it doesn't happen to the front dude which is the only one following the mouse so maybe it's the actual x/y coordinates of the parent objects (the "back" end of each segment is where the origin is and the segment behind it is its child) that are screwing things up.

    Things I have tried:
    using sprites instead of draw_line
    flooring every vector calculation

    Video (watch fullscreen):


    Code:
    //Segment Object
    
    //create
    bx = 0
    by = 0
    width = global.width
    length = global.length
    angle = 0
    parent = 0
    dir = 0
    
    //step
    var dx = length * dcos(angle)
    var dy = length * -dsin(angle)
    
    bx = x+dx
    by = y+dy
    
    if(point_distance(bx,by,parent.x-lengthdir_x(length, angle),parent.y-lengthdir_y(length, angle)) > 20){
        speed = global.speed
        dir = point_direction(x,y,parent.x,parent.y)
      move_towards_point(parent.x-lengthdir_x(length, angle), parent.y-lengthdir_y(length, angle), speed)
    }
    else{
        speed = 0
    }
    
    angle = dir
    
    //draw
    draw_line_width(x, y, bx, by, width);
     
    Last edited: Jan 13, 2020 at 12:16 PM
  2. p4stoboy

    p4stoboy Member

    Joined:
    Nov 6, 2018
    Posts:
    17
    Tried using lengthdir instead of dcos/dsin but still no good
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice