Jump to content


Photo

Path Drawing


  • Please log in to reply
4 replies to this topic

#1 Corcor 7

Corcor 7

    GMC Member

  • New Member
  • 163 posts

Posted 20 December 2008 - 04:33 AM

Hello, I was looking into paths and had a great success with it so far. My only issue is drawing a line from the objects starting position to the left click position. I currently have this code to draw a 1 pixel-wide line for the path, but I want to set the width of the path line to around 5 pixels.
[codebox]
//Draw Event
draw_set_color(c_red);
draw_set_alpha(0.6);
draw_path(pth_define,0,0,true);//pth_define is the path name
[/codebox]
Is there any way of tweaking it so that I could achieve this? Any help is appreciated! Thank you,

Corcor 7
  • 0

#2 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 20 December 2008 - 05:12 AM

http://gmc.yoyogames...&...t&p=2347374

Just change the draw method in the loop
  • 0

#3 Corcor 7

Corcor 7

    GMC Member

  • New Member
  • 163 posts

Posted 21 December 2008 - 12:20 AM

I thought of another way to do it, but I'm not too sure how to do it, either..Would it be possible to draw a line that conforms to the shape of a path? I'm trying to have a Fire Emblem / Advance Wars style movement. Any help is appreciated!

Edited by Corcor 7, 21 December 2008 - 12:24 AM.

  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 21 December 2008 - 08:15 AM

I checked the link from Icuurd´s post above and stripped the code down to this...

var nu,i,p;
nu = path_get_number(mypath);
n = path_get_precision(mypath)*nu;
for (i = 0; i < n-1; i += 1)
{
draw_line_width(path_get_x(mypath, i/n), path_get_y(mypath, i/n), path_get_x(mypath, (i+1)/n), path_get_y(mypath, (i+1)/n),6);
}

it works, but if the precision is less than 8 it looks a bit odd...

Another way would be to use this

for (i=-3; i<4; i+=1)
{
draw_path(mypath,path_get_x(mypath,0)+i,path_get_y(mypath,0)+i,false);
}

But, again, it looks a bit odd...

Don´t know if this is any help, but at least it may point you in the right direction!
  • 0

#5 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 21 December 2008 - 08:43 PM

I also have a banner tutorial that draws textured primitive using paths... You can check it out

Edited by icuurd12b42, 21 December 2008 - 08:43 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users