Page 1 of 1

line to problem, really jimmy?

PostPosted: Thu May 28, 2009 2:36 am
by jimmynewguy
Wow, why can't i do a line to x, y coordinates
ie:
Code: Select all
lineto(player.x, player.y);

i set the pen so it's not that, and it will work if i say line to 10, 100 but with .x and .y it wont. That makes no sense to me whatsoever. Even if i do
Code: Select all
int x2,y2;
x2 = player.x;
y2 = player.y;
lineto(x2, y2);

it wont work. Is there some reason to this?

Sorry if i sound mad, i'm a little worked up over this :oops:

Re: line to problem, really jimmy?

PostPosted: Thu May 28, 2009 3:35 am
by skydereign
It might be because of the canvas has its own xy plane... kind of. Check this, not sure what you are trying to draw with the line, so it could just be your initial... Does the line actually draw?
http://game-editor.com/forum/viewtopic.php?f=5&t=6853&start=0

Re: line to problem, really jimmy?

PostPosted: Thu May 28, 2009 4:14 am
by DST
x2=abs(player.x-x); seems like it would work. Dunno about the negative xy's though,
y2=abs(player.y-y); i always just put my canvas at game center. Makes it easier.

Funny though, i was going to say more but someone called me in the middle of typing out my example, and during that time sky came in and posted ahead of me. lolol.

Re: line to problem, really jimmy?

PostPosted: Thu May 28, 2009 4:26 am
by Hblade
If you'd like, I could show you another method of making the line follow the actor.

Re: line to problem, really jimmy?

PostPosted: Thu May 28, 2009 1:06 pm
by jimmynewguy
lol i knew it was gonna be something obvious i didn't think of (not too obvious) thanx to all, but DST's method was the one i was looking for :D