draw lines between previous lines?

0 favourites
  • 3 posts
From the Asset Store
You can change amount and speed of circles, length of lines and etc. Only 6 events.
  • Hi. New to C2.

    I want the user to be able to swipe the screen either in an up(ish) or down(ish) move, and a line will begin to draw where they touched and spread from that point in 2 directions (left to right if they swiped horizontally for example). The line should stop drawing itself once it hits an immovable solid (like a previously drawn line or a block on the screen).

    Can't figure this out.


  • Hmmm... my best thought is to make a sprite for your line. Make sure the sprite's origin point is at one of the ends of the sprite. You'll actually use two sprites with instance variables to "grow" the line with their origin ends touching and the "lines" facing opposite angles. Then use something like "Every tick - if Line.isgrowing - set Line height to Line.height+300*dt" to grow the lines. Then make a separate event for when the lines finally collide or overlap with one of your solid object and in there you set Line.isgrowing to false.

    edit: note the "dt" is just to make your lines not grow faster/slower when your framerate changes and makes inserting a pause function easier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. That helped a lot :o)

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