Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-21-2002, 09:34 AM   #1
remc
Registered User
 
Join Date: Aug 2002
Location: France
Posts: 5
Default Click and Play game...

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
remc is offline   Reply With Quote
Old 08-21-2002, 09:49 AM   #2
Ricod
(@_@) -("pretty lights")
 
Ricod's Avatar
 
Join Date: Sep 2001
Location: the Netherlands
Posts: 3,988
Default

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:
on(mouseDown) { _root.targetX = _root._xmouse; _root.targetY = _root._ymouse; }

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 ?
Ricod is offline   Reply With Quote
Old 08-21-2002, 10:00 AM   #3
christobal
Registered User
 
Join Date: Jul 2002
Posts: 13
Default

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
christobal is offline   Reply With Quote
Old 08-21-2002, 12:23 PM   #4
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: EGYPT
Posts: 12,439
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

http://www.bit-101.com
hit the tutorials button
u will find what u want and more
__________________
â€* GOD Is Near â€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:22 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.