0 Favourites

How do I draw a line between two points ? [SOLVED !]

  • Hi everyone !

    Since a week, I'm blocked by a simple problem : draw a line between two points. I create a function for that, but the position of the line is not the position I choose and I'don't know why

    If somebody have an idea...

    the capx file

  • Your code works. The reason your line is spawning in the middle is because, the origin point is in the center of your Sprite so when you set your objects width it will expand in both directions, You could always fix this by positioning your object between the positions or just change the origin to something like this

    Here's the example all I did was change the origin

    Good luck with your project if you have any questions just ask or PM me

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • the origin of the Sprite2 object has to be left and it works (see the image editor to edit image points)

    EDIT: ninja'd

  • Your code works. The reason your line is spawning in the middle is because, the origin point is in the center of your Sprite so when you set your objects width it will expand in both directions, You could always fix this by positioning your object between the positions or just change the origin to something like this

    Here's the example all I did was change the origin

    Good luck with your project if you have any questions just ask or PM me

    Hooo ! It was so simple, thank you very much

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)