how to click/move

Game Editor comments and discussion.

how to click/move

Postby JER » Tue Apr 11, 2006 10:11 pm

How can I make a actor move when i click to the spot i clicked?
thanks
JER
 
Posts: 8
Joined: Tue Apr 11, 2006 8:38 pm
Location: Illinois
Score: 0 Give a positive score

Postby makslane » Tue Apr 11, 2006 10:31 pm

Use the 'Mouse Button Down' event and enable the drag option.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby JER » Tue Apr 11, 2006 11:40 pm

that didnt work at all
JER
 
Posts: 8
Joined: Tue Apr 11, 2006 8:38 pm
Location: Illinois
Score: 0 Give a positive score

Postby makslane » Tue Apr 11, 2006 11:54 pm

You need put some action.
Try 'Visibility State' enable
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby frodo » Tue Apr 18, 2006 4:27 pm

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.
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby frodo » Tue Apr 18, 2006 4:34 pm

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.
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby ingsan » Thu Apr 20, 2006 6:38 am

User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby sali11 » Fri May 19, 2006 9:14 pm

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
sali11
 
Posts: 37
Joined: Sun Apr 30, 2006 6:51 pm
Location: LONDON
Score: 0 Give a positive score

Postby frodo » Sat May 20, 2006 4:31 pm

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.
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby sali11 » Sat May 20, 2006 7:52 pm

ok, thats what I did wrong. ill try it and see if it works, thanks for that :)
sali11
 
Posts: 37
Joined: Sun Apr 30, 2006 6:51 pm
Location: LONDON
Score: 0 Give a positive score

Postby sali11 » Sun May 21, 2006 4:52 pm

Hi frodo, after lots of attempts I have finaly got it to work, and it is brill. thanks for your help. :D

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 :cry: 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
sali11
 
Posts: 37
Joined: Sun Apr 30, 2006 6:51 pm
Location: LONDON
Score: 0 Give a positive score

Postby frodo » Tue May 23, 2006 12:30 am

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.
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby sali11 » Tue May 23, 2006 6:59 pm

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
sali11
 
Posts: 37
Joined: Sun Apr 30, 2006 6:51 pm
Location: LONDON
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest