| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Aug 2002
Location: France
Posts: 5
|
Hi !
Maybe someone could help me? How can i do this : - The player is in an area, he click on a place in this area, and the hero go to this clicked area. (hmm..i hope you understand my poor english...) Is it possible? REMC |
|
|
|
|
|
#2 |
|
(@_@) -("pretty lights")
Join Date: Sep 2001
Location: the Netherlands
Posts: 3,988
|
Funny, I was busy doing this right now ...
Anyway, u can use the on mouseDown or mouseUp to catch the click, and then using the _ymouse and _xmouse to get the x and y coordinates of the spot you clicked. It would look something like : ActionScript Code:
now u can compare these values to the x and y coordinates of your 'player'. If the players x is less than the targetX the _x needs to increase (else vice versa). Same thing for the _y. Do this gradually with a loop. To make a nice curve, u can use some functions ... ehr, my math sucks ... sumthing like instead of _x += 10 u would use the one with the degrading curve ... ehr, someone else can jump in here ?
__________________
RicoD Link ? |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Jul 2002
Posts: 13
|
1 Attach an mc to yur mouse pos (like if you drag a clip but in this case an empty clip). Instance it as say maybe mouseClip . In mouseClip build a simple function that sets its x and y pos in variables.
like: function newPos() { _root.myXPos = this._x; _root.myYPos = this._y; } call function when you click on (release) { newPos(); } create two variables for the new x and new y positions var myXPos; var myYPos; use a clip event on your man movie clip that sets its position in relation to the new x and y position variables. like; onClipEvent (enterFrame) { this._x = myXPos; this._y = myYPos; } that probably needs some fine tuning but basically that kind of thing should work fine if I understand you, don't forget to make sure you target the variables propeerly in relationship to where you have placed them good luck |
|
|
|
|
|
#4 |
|
Addicted To FLASH
|
__________________
â€* GOD Is Near â€* Questions Don't PM for Questions An eye for an eye, make the whole world blind _____________________________________________GHANDI |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|