Page 1 of 3

GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 8:30 pm
by bat78
Hello developers,
One think murdering me in gE. It disallow me to finish my game also x:
I tried with all possible codes that makes the actor to follow mouse (including Follow Mouse O_o) And i noticed that the actor do not follow the mouse in bits.
Like.. the actor need time before he gets to the mouse, if you move the mouse faster.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 8:55 pm
by skydereign
So you want the actor to follow the mouse with a delay? If you don't want it to accelerate, you can just do this.
Code: Select all
angle = direction(xscreen, yscreen, xmouse, ymouse);
directional_velocity = 10;

It is only slightly trickier if you want it to accelerate, but you can use vectoradd to achieve smoother movement.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 8:57 pm
by bat78
I doubt it will work. Its just the xmouse/ymouse.
I have noticed that the coordinates xmouse nad ymouse just do not respond as the original mouse coordinates if you move the mouse faster.
Maybe we can use ceil(); on xmouse/ymouse. I just don't know about this..

You know drawing into a canvas. I wan't that. Like immediately positioning actor to the mouse. Like drawing without canvas.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 9:03 pm
by skydereign
So you want the mouse to have a bullet physics like effect. That is to say it moves over an area faster than a frame, you would still want it to register mouse events for all actors it passed through. Yes? Generally this isn't possible due to the nature of how gE handles frames. However you can do one of two things. Increasing the fps will allow gE to detect more transition states when the mouse moving. This isn't perfect. The other is to assume the mouse moved in a straight line from the previous mouse position to the current one. If you are using canvas as a drawing tool, this is rather effective. Otherwise, you can create mouse actors that handle collision events with whatever actor you wanted the mouse over event (rather inefficient, but it gets the idea across).

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 9:04 pm
by bat78
So you want the actor to follow the mouse with a delay?

No, i wan't the oposite. The actor to follow the mouse with NO DELAY.
If u can notice, while using xmouse/ymouse, the actor have delay in following mouse if u move the mouse faster.
Also if u compare it in bits. You only have to move mouse really slow to be 1 : 1.

The example on gE for using xmouse and ymouse (with the star) u know it. It looks like drawing with the star. And u can see it. It is not like drawing when u move the mouse faster, it becomes on dots.
How it should be: --------------------------
How it is: - - - - - (if u move the mouse faster)

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 9:08 pm
by bat78
If actor can have an collation with canvas's setpen then there is no problem. Since i think its not possible, i want to draw like that, but with an actor - with means
using follow mouse events - like xmouse and ymouse. But yes.. moving mouse faster cause xmouse/ymouse not exact. Just frames must be more...faster idk o-o

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 9:11 pm
by skydereign
bat78 wrote:The example on gE for using xmouse and ymouse (with the star) u know it. It looks like drawing with the star. And u can see it. It is not like drawing when u move the mouse faster, it becomes on dots.
How it should be: --------------------------
How it is: - - - - - (if u move the mouse faster)

I don't actually know it, but this problem can be fixed with the method I mentioned in my last post. All you need to do is keep track of the previous xmouse/ymouse values, and do this.
Code: Select all
moveto(xmouse_prev, ymouse_prev);
lineto(xmouse, ymouse);

And that will draw a smooth line between the two. Now, the higher the fps the more accurate this technique will be. Note it is still possible without the canvas actor, you just need to make sure to connect them in the same way (that line).

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Mon Jun 03, 2013 9:12 pm
by bat78
moveto & lineto is in case u can use canvas and set a pen in. But i can't.
My game style do not allow me. This class of games are rare (Maybe because in all platforms they have similar bugs) but one think is sure - It sounds easy on theory.
So maybe u know that: http://www.buzzedgames.com/draw-ball-2-game.html - Take attention on the specific drawing there. Ball collade with a drawed patch.
Its created with Java but we both know C++ is more advanced then Java. The Java is just more easy.
Well im making game like that (MUCH more advanced) And thats the only problem.
I will share the credit with u (the game's database is completely mine) If we can figure out how we can build that.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Wed Jun 05, 2013 5:33 pm
by bat78
what do u think about this algorithm:
Code: Select all
distance(ball.x, ball.y, xmouse, ymouse)/directional_veloicity;

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Wed Jun 05, 2013 6:47 pm
by Hblade
You can also use min, max after that to set how fast it can go, meaning it follows the mouse smoothly but has a limited speed :)

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Wed Jun 05, 2013 8:03 pm
by bat78
xscreen = xmouse;
yscreen = ymouse;

Thats not velocity :( can't use all that.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Thu Jun 06, 2013 12:23 am
by skydereign
Your posts are usually pretty confusing, and it is very hard to understand what you actually want. I've already mentioned the following as a solution, which you denied. I'll post an actual example, so I don't know if it was you not understanding me, or me not understanding you. Remembering that this solution is not specific to the canvas.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Thu Jun 06, 2013 8:37 pm
by bat78
dreign, thats drawing in canvas. I cant use canvas. I gived u game as an example what more.
Actor will have collation to the patch im drawing, thats how should the drawing be. Drawing with actor. (Particle/Factory) gE Tutorial x:
The problem is the drawing when u move the mouse fast. It become on dots. Thats all.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Fri Jun 07, 2013 6:10 pm
by skydereign
bat78 wrote:dreign, thats drawing in canvas. I cant use canvas. I gived u game as an example what more.

I know, and I gave you a solution that didn't need canvas (as I mentioned twice). You just need to use the same idea as the example I posted.

bat78 wrote:The problem is the drawing when u move the mouse fast. It become on dots. Thats all.

The solution to this, as posted at least twice, is to create a line from the previous mouse position to the current one. This is in the same way that the example I previously posted. But since you still don't understand what that means, here is another example.

Re: GE's disadvantage? - Actor follow mouse in a bit?

PostPosted: Fri Jun 07, 2013 8:19 pm
by Hblade
You can have a lot of fun with that sky xD