Page 1 of 1

how to do drawing functions with an actor not a mouse.

PostPosted: Mon May 25, 2009 4:01 am
by avagp
How i can make this?:
i want my actor to be followed by a line of the drawing functions.
in my game the mouse is not used.

I have tried a lot, but i can´t.
someone help me with this. :cry:

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Mon May 25, 2009 4:32 am
by skydereign
Well, the canvas needs variables in which to draw. So, you feed the canvas the actors xy. Your problem might be that the xy seems different. I think that canvas uses its own, so you would need to either position the canvas absolute to the real xy, ie. the origin, or find the difference from the origin. Another idea is that you just use the actual xy in accordance to the draw... Just to make sure I get what you are asking, you want a line drawn from a canvas to follow an actor. The following would be achieved by erase and draw. The following is just variable manipulation. I could make a demo if you want.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Tue May 26, 2009 5:05 am
by avagp
Exactly, what i was trying to do was to make a line, drawn from a canvas, to follow an actor that I move.
You got the point, i cant get the exact coordinates.
I´m confused.



Thank you for your reply, and i will be grateful if you make a demo for me, that will dissipate all my doubts (i think :D ).
In advance i give you a point for your comprehension and worry. :mrgreen:

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Thu May 28, 2009 1:47 am
by skydereign
This shows how I got the coordinates, and also drawing a line. Not sure if it is the same movement, but if you need any more help, feel free to ask.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Thu May 28, 2009 4:59 pm
by avagp
Your demo helped me a lot. (in fact i used it to do this) :) , but I thought something more like this.

The thing is, i have an actor that is followed by the view, also i have another actor with the same commands (i mean the drawing functions). Until here i´m done.
However, i would like this "draws" (lines, whatever), to paint the background (in the demo i used the actor base as a background) like actor3 in the demo, but i don't want to use an animation to draw, because the game gets slow after a while.

One last question: my game is up to 4 players and it has a problem, when i try to play with 4 people, sometimes the keys does not respond, i belive because the total of the pressed buttons.
¿there is a way to fix this, is my keyboard the problem, or making a 4 player game is completely absurd?

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Thu May 28, 2009 11:11 pm
by skydereign
Yeah, certain keyboards will allow more keydown events... It is not gameEditor if that is what you are thinking.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Mon Jun 01, 2009 6:07 pm
by avagp
I managed making an actor to paint the background, using the "draw form" function.
But yet i can not set 2 pens in the same canvas actor. It´s possible?

Or maybe there is a way that seems that you are having 2 pens to draw. Like, if you juxtapose 2 canvas actor, slightly tranparents.

Skyderiegn, you have ay ideas to do that, or someone who knows how??

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Mon Jun 01, 2009 10:18 pm
by skydereign
The only way I can think of right now is to have variables to act as different pens. You can setpen anytime you like, so if you draw something, line a, then in the same script you can draw line b with a different pen. The only problem would be placement, but you can just hold that with variables.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Tue Jun 02, 2009 3:10 pm
by avagp
Ok, this is what i understood: i can change colors for the pen, so that would seem to be 2 different pens.

You said i can setpen anytime i like, but that includes more than one pen at the same time and at the same canvas actor?
Because that is my complication.

This will be my game, in synthesis (maybe this will help, i do not know):

I have 2 or more players moving on a stage, and each player has a color. When one player moves(it moves like a super smash bros player: jumping, dodging, walking, running, back and forth through the stage), it leaves a line exactly where it passed, with it's respective color (like a stele).
Also, the camera follows one of the players.
And all at the same time.


Well... that is it. :D

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Tue Jun 02, 2009 11:39 pm
by skydereign
Well, not exactly sure how you are drawing it, but if you have multiple draws within a single script you would draw the first, reset the pen and draw the next. The thing is that you are going to draw something, it seems you want two different things drawn on canvas from one event, if so that would work, if not just add a setpen specific to the event. The events are done separately, so as long as you have the setpen at the beginning of the scripts, it will be fine.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Wed Jun 24, 2009 1:31 am
by wizfit
I'm trying to do something similar to the original poster. Mainly I want a line to be drawn that can activate a collision event behind an actor, but I'd like it to be drawn along the path it's traveling.

If that's not possible I want to be able to draw a spiral that has the collision event.

Thanks

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Wed Jun 24, 2009 2:44 am
by skydereign
The collision itself will not be triggered by canvas. You can do a pixel check, but really, you can't do it cleanly. You could use an outside actor, and just use canvas to draw it, that way the pixel check would be easier. I don't think collisions, built in ones, will work at all, because you are no longer dealing with set actors, but if you were to use DrawActor, then it would not really be drawing a spiral, and still actor based.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Wed Jun 24, 2009 4:26 am
by DST
Sure they will. Just add a collision>any side>canvas actor.

It will collide with any part of the canvas that is holding pixels.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Wed Jun 24, 2009 4:41 am
by skydereign
Cool, did not know that. I guess that would make sense, in that case it would be the same as the previous method, but add the collision.

Re: how to do drawing functions with an actor not a mouse.

PostPosted: Wed Jun 24, 2009 9:58 pm
by wizfit
Thanks for the fast responses!

I know it'll work now, but unfortunately I'm very new to GE and I'm unsure of how to draw a spiral. Another key component of this is that I need to be able to control the speed that the spiral is drawn. Is it possible to do that with the draw function?

What I'm trying to do is create a snake that spirals out from a center point, the body created behind the head as it moves.

thanks for the help