Page 1 of 1

Drawing function help

PostPosted: Wed Apr 30, 2008 11:35 pm
by smillz
I'm kinda new to drawing functions, and I thought a canvas actor would add some interesting attributes to my game so I have some questions to what I can and cannot do.

Question 1: How can I make the whole canvas actor to instantly change one color?
Question 2: Can I have the pen to draw from an actor instead of the mouse?
Question 3: Can I make the pen circular instead of square?
Question 4: Can I have an actor collide only with the drawn portion in a canvas actor?
Question 5: Can I use a Draw From function on an area instead of just on an actor?

Thanks :D

Re: Drawing function help

PostPosted: Thu May 01, 2008 12:50 am
by makslane
smillz wrote:Question 1: How can I make the whole canvas actor to instantly change one color?


Use the funcion erase:
http://game-editor.com/docs/script_reference.htm#erase

Question 2: Can I have the pen to draw from an actor instead of the mouse?


Just use the coordinates of the actor, instead the mouse position.

Code: Select all
int xn, yn;

xn = youractor.xscreen;
yn = youractor.yscreen;

screen_to_actor(&xn, &yn);
putpixel(xn, yn);


Question 3: Can I make the pen circular instead of square?


No, sorry

Question 4: Can I have an actor collide only with the drawn portion in a canvas actor?


Sure! But first, make sure erase the canvas with a transparent color, like:

Code: Select all
erase(0, 0, 0, 1);


Look the attached file.

Question 5: Can I use a Draw From function on an area instead of just on an actor?


You can use only in canvas actors.

Re: Drawing function help

PostPosted: Thu May 01, 2008 3:22 am
by smillz
Thanks! I needed it :wink: