draw lines between previous lines?

Get help using Construct 2

Post » Wed Jan 30, 2013 12:34 pm

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.
Help!
B
10
S
3
G
3
Posts: 29
Reputation: 2,692

Post » Wed Jan 30, 2013 3:32 pm

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.Phyvo2013-01-30 15:35:36
B
6
S
1
Posts: 40
Reputation: 917

Post » Tue Feb 12, 2013 3:34 pm

Thanks. That helped a lot :o)
B
10
S
3
G
3
Posts: 29
Reputation: 2,692


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas and 0 guests