View Full Version : Fighting game
06-09-2002, 06:18 PM
I have made a fighter in flash that can punsh move and kick.
But now i need something to punch and kick at. maybe a second player. I have NO idea how to do this. can anybody help me???
06-09-2002, 06:34 PM
You can always create new player who can get kicked and punched... :)
06-09-2002, 06:37 PM
Yeah ok, but the player2 must get hit when i punch ( or kick:) ) and i dont know how to do that. anyone a idea??
06-09-2002, 10:29 PM
Why don't you start with two blocks or something that will represent player1 and player2 and use hitTest or something to create the interaction and when you got this working, you can expand it to more complex objects???
Just my 2 cents...
06-10-2002, 12:32 PM
hmmm, yeah ok but what do you mean with hitest?
06-10-2002, 10:49 PM
hitTest is one of the Flash's builtin function that can be used to do things like what you want to do...
Detailed info from the ActionScript Dictionary...
anyMovieClip.hitTest(x, y, shapeFlag);
x The x coordinate of the hit area on the Stage.
y The y coordinate of the hit area on the Stage.
The x and y coordinates are defined in the global coordinate space.
target The target path of the hit area that may intersect or overlap with the instance specified by anyMovieClip. The target usually represents a button or text-entry field.
shapeFlag A Boolean value specifying whether to evaluate the entire shape of the specified instance (true), or just the bounding box (false). This argument can only be specified if the hit area is identified using x and y coordinate arguments.
Method; evaluates the instance specified by anyMovieClip to see if it overlaps or intersects with the hit area identified by the target or x and y coordinate arguments.
Usage 1compares the x and y coordinates to the shape or bounding box of the specified instance, according to the shapeFlag setting. If shapeFlag is set to true, only the area actually occupied by the instance on the Stage is evaluated, and if x and y overlap at any point, a value of true is returned. This is useful for determining if the movie clip is within a specified hit, or hotspot, area.
Usage 2 evaluates the bounding boxes of the target and specified instance, and returns true if they overlap or intersect at any point.
Flash 5 or later.
The following example uses hitTest with the x_mouse and y_mouse properties to determine whether the mouse is over the target's bounding box:
if (hitTest( _root._xmouse, _root._ymouse, false));
The following example uses hitTest to determine if the movie clip ball overlaps or intersects with the movie clip square:
trace("ball intersects square");
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.