Page 1 of 1
how to click/move
Posted:
Tue Apr 11, 2006 10:11 pm
by JER
How can I make a actor move when i click to the spot i clicked?
thanks
Posted:
Tue Apr 11, 2006 10:31 pm
by makslane
Use the 'Mouse Button Down' event and enable the drag option.
Posted:
Tue Apr 11, 2006 11:40 pm
by JER
that didnt work at all
Posted:
Tue Apr 11, 2006 11:54 pm
by makslane
You need put some action.
Try 'Visibility State' enable
Posted:
Tue Apr 18, 2006 4:27 pm
by frodo
have an actor without an animation. do create actor--> script editor:
xscreen=xmouse;
yscreen=ymouse;
VisibilityState("Event Actor", DONT_DRAW_ONLY);
right click on the invisible actor, and click new activation event, create actor, and select your player actor. in player actor, do a new event, activation event, from your invisible actor, and do script editor and enter this code:
angle=direction(x,y,invisible.x,invisible.y);
directional_velocity=6;
do add, collision a=on any side of the invisible actor, and enter this in script editor:
yvelocity=0;
xvelocity=0;
DestroyActor("invisible");
then create a filled region actor. in creat actor do follow mouse, both. then do mouse bothon down, left, create actor, invisible actor.
and do invisible actor don't creat at start up.
whew! I hope that works.
Posted:
Tue Apr 18, 2006 4:34 pm
by frodo
oh, the player actor can have a 360 degree animation. you can edit the activation event from invisible actor, and add in on the next line:
animpos=(angle/360)*(nframes);
That will make it will piont toward the place it is walking to.
Posted:
Thu Apr 20, 2006 6:38 am
by ingsan
Posted:
Fri May 19, 2006 9:14 pm
by sali11
Hi frodo, im trying to apply your code on my ball, but when I use the code:
angle=direction(x,y,invisible.x,invisible.y);
directional_velocity=6;
I get an error message.
also the end of the instructions is a bit confusing to me. I dont suppose you could explain it in some more detail for me? that would be great if you could. I have the latest version of GM
thanks if you help me out with this
Posted:
Sat May 20, 2006 4:31 pm
by frodo
Make sure your invisible actor is named "invisible". If it isn't, it will make the error message come up.
Here is the end in better detail:
Create a filled region actor called "clicker". In create actor do a new action, follow mouse. Then do mouse botton down, left click on the event box, and do create actor, your invisible actor.
Then left click on your invisible actor and do don't create at start up.
I hope that is a little better.
Posted:
Sat May 20, 2006 7:52 pm
by sali11
ok, thats what I did wrong. ill try it and see if it works, thanks for that
Posted:
Sun May 21, 2006 4:52 pm
by sali11
Hi frodo, after lots of attempts I have finaly got it to work, and it is brill. thanks for your help.
I had got my ball set up so that when I click on it with the left mouse button I could drag it around the screen, took me a while to get that to work and now after setting this up, the drag has stopped working
I tried to apply the drag on the right mouse button instead but that is also not working. I think its because I have the invisible actor under the mouse now. I dont suppose you would have an easy fix for this problem?
thanks for your help again
Posted:
Tue May 23, 2006 12:30 am
by frodo
do mouse button down (drag enabled) action script editor. in script editor type:
x=x;
then you can drag your ball all over the screen.
Posted:
Tue May 23, 2006 6:59 pm
by sali11
Hi frodo, I did what you said. I applied that code to the ball. However there is a strange bug with it. some times it works,some times it dont. Ill click and drag and it wont work, ill keep trying then all of a sudden it works, I let go and try again and it dont work again.
Also with the click to mouse thing, some times I have to click sevrel times before the ball gose towards the mouse. and some times after many goes it stops working so I then have to close the game and re- load it. Strange bugs no?
I dont suppose you have ever had this sort of problem with any of your games? thanks for your help in this. I hope you have seen this problem before and know what I have done wrong. thanks again