Trying to draw a line starting from the point

Forum Home Forum Home > Construct 2 General > How do I....?
 Post Reply Post Reply
Author
467 Rep
Post Options Post Options   Quote samur Quote  Post ReplyReply Direct Link To This Post Topic: Trying to draw a line starting from the point
    Posted: 17 Oct 2011 at 10:54pm
I want to draw a line, which will start from one point (ImagePoint) to the next point. I did it with setting line width with each tick, but it draws from the point in two directions and I want it only to go up. So basically I want to draw a line which will go just in one direction (upwards). How to do it?
Back to Top
1,250 Rep
Post Options Post Options   Quote komes Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2011 at 11:34pm
Umm coming from a noob who likes math. You could use a line algorithim like ( Bresenham algorithm ) and try and implement it in construct. I will try to do so if i get it working i will post it.
Back to Top

Moderator
29,640 Rep
Post Options Post Options   Quote Kyatric Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2011 at 12:36am
Check out in c2folder\examples (in your install of C2 on your HDD) there is one example called "Physics - distance joint.capx".
In this capx, the line is a sprite (just a color filled) and both sides of the sprite are "tied" to specific points.

Check it out, this should help you setup things the way you want.
Back to Top
16,364 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2011 at 1:22am
Originally posted by samur samur wrote:

I want to draw a line, which will start from one point (ImagePoint) to the next point. I did it with setting line width with each tick, but it draws from the point in two directions and I want it only to go up. So basically I want to draw a line which will go just in one direction (upwards). How to do it?


Did you try to set the hotspot to the side of the image?
Like for width set it to 0x, or 4 on the numpad.
The if using height set it to y max, or 2 on the numpad.
Back to Top
467 Rep
Post Options Post Options   Quote samur Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2011 at 6:12pm
Thank you! Got it covered :) Just like @newt proposed I set a hot spot to one side of the image and it's working :)

@Kyatric Unfortunetly I don't have Physics - distance joint.capx example file. Probably because I have a free version?
Back to Top
6,899 Rep
Post Options Post Options   Quote zenox98 Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2011 at 6:16pm
@samur

You should have ALL the same examples as everyone else - even the 'Early Adopters'. The installation file is the same for everyone - just some functionality is different when you pay (more layers, events etc allowed).

What version have you got? Might want to try re-downloading the current R63 version.

Edited by zenox98 - 18 Oct 2011 at 6:20pm
Spec:
OS: Windows 7 SP1 64bit, Intel I7-2600 3.4 GHz, Memory: 8 GB, Gfx: GeForce 560TI DirectCUII.
Back to Top
467 Rep
Post Options Post Options   Quote samur Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2011 at 6:33pm
OK - after reinstal I have this example. I'll study it, thanks! :)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down