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

Just started using Construct 2? Post your questions here

Post » Tue Oct 18, 2016 5:27 pm

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
Last edited by DrKoala on Tue Oct 18, 2016 7:08 pm, edited 1 time in total.
Mr. Jelly! Mr. Jelly!
Error At Address: 14, Treacle Mine Road, Ankh-Morpork
MELON MELON MELON
Divide By Cucumber Error. Please Reinstall Universe And Reboot
Whoops! Here Comes The Cheese!
Oneoneoneoneoneoneone
B
19
S
4
Posts: 6
Reputation: 1,016

Post » Tue Oct 18, 2016 6:09 pm

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

Image

Here's the example all I did was change the origin
https://www.dropbox.com/s/9hjznsrsg4e0a ... .capx?dl=0

Good luck with your project if you have any questions just ask or PM me :D
B
12
S
8
G
3
Posts: 33
Reputation: 3,483

Post » Tue Oct 18, 2016 6:14 pm

the origin of the Sprite2 object has to be left and it works (see the image editor to edit image points)

https://1drv.ms/u/s!AjkoCSebIn9JiwT3jKTZf57ygKnU

EDIT: ninja'd
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Tue Oct 18, 2016 7:00 pm

Brandon12hummer wrote: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

Image

Here's the example all I did was change the origin
https://www.dropbox.com/s/9hjznsrsg4e0a ... .capx?dl=0

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


Hooo ! It was so simple, thank you very much :D
Mr. Jelly! Mr. Jelly!
Error At Address: 14, Treacle Mine Road, Ankh-Morpork
MELON MELON MELON
Divide By Cucumber Error. Please Reinstall Universe And Reboot
Whoops! Here Comes The Cheese!
Oneoneoneoneoneoneone
B
19
S
4
Posts: 6
Reputation: 1,016


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests