Draw Line

0 favourites
  • 5 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hey guys, I just wanna know how can I draw a line automaticly in construct! I mean I wanna a line be drawn in center of layout. I have seen "Canvas" Plugin, but I don`t know how can I work with that. anyone here can help me?

  • i believe i read something about canvas support in full version, however, being as you know where you want your line, why not just make a sprite? something rectangular, 5x100 or something like that, and disable initially visible, when you want the line drawn , set visible.

    maybe try using something like,

    set sprite width to distance (origin.x,origin.y,mouse.x,mouse.y)

    set sprite angle to mouse.x, mouse.y

    this will set the length or width of the sprite to the distance between your start point and where you clicked.

  • No, I meant, I wanna make a line in layout and that automaticly Stretch out anytime. and after an evnet (like after 3 seconds) that line will be tilted. So I don't think so your method can help me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sorry for the late response, if you havent figured it out yet, maybe something along the lines of on trigger set x to x+ Mouse.x2-mouse.x1

    then have 2 variables to click a start and finish point, so that it changes the sprites length to the distance of the sprite, plus the difference in distance between the two clicks.

    so as if it was a 4 unit box, and you clicked at 4 and 7 pixels hypothetically, the code would run 4 + (7-4) = 4+(3) and set the new length to 7. but even if you dont click exactly where the box ended the math would add up even if you clicked at 17 and 20. however if you clicked at 20 and then 17, the math would say, set x to 4 + (17-20)= 4+(-3) and set new length to 1, as 4 -3 is 1, successfully shortening your line.

    an easier way to do this , though i dont know its applicable in your situation, would be to add a slide bar, and set sprite.x to slidebar.value

  • that may adjust position instead of size, instead of set x set width/length

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