ActionScript 2.0 :: [FlashCS3] Distance Detection To Set Depth Of Movieclips

Jul 5, 2010

I am working on a game engine that works like an overhead RPG, but the terrain is drawn at an angle with the characters at the same angle to give the illusion of a 3D world. the problem I am running into is that, while I can get the character to move perfectly fine on the ground, I need to be able to set the character to go behind or above certain objects depending where he is.

The best example of what I am trying to accomplish is from Gaia's MMO.

[URL]

As you can see in the first frame of the image, the character is in front of the bush, but behind the lamppost. In the second frame he is both behind the lamppost and bush. In the last frame, he is in front of both the lamppost and bush. during all of this though the bush and Lamppost never change position with the terrain or each other.

Basically, I have come to the conclusion that I believe the way this RPG is able to do this is through distance detection and depth swaps.

ex. if distance is above 0 character is above object. if distance is below 0, character is below object.

The main I would like to accomplish with this is the character, enemies, and NPC's are the only thing that changes depth. why? If an enemy is following and is on a different depth then the character, possibly higher or lower then the object, it could appear above or below the object while the character is the opposite.

View 3 Replies


Similar Posts:


ActionScript 2.0 :: [FlashCS3] Dynamically Loaded MovieClips Don't Respond To Mouse Events?

Apr 29, 2008

I'm trying to place 5 instances of a horizontal line (mcLine) starting at 78% from the top of the Stage. This all works fine, but I want to be able to have these dynamically created MovieClip instances register mouse events and they don't.First the setup of the mcLine instances:

var nFirstLineY:Number = (Math.round(Stage.height*.78));
var nLineSpace:Number = 22;
var nWaitTime:Number = 1000;[code]...

If I place instances of the mcLine MovieClip on the stage and name them line_1, line_2, etc., the function LineVibrate works, but when I try to add the instances at run time as above, the LineVibrate function stops working.

View 4 Replies

IDE :: Detection Of Mouse Movement Distance?

Aug 12, 2009

how to detect the distance of the mouse movement in a certain time. I d like to be able to calculate the distance the mouse was moved from one point to another in certain time (one second) and compare these values.

View 2 Replies

ActionScript 2.0 :: Detection Of Mouse Movement Distance

Aug 12, 2009

I am wondering if anyone can share with a good example on how to detect the distance of the mouse movement in a certain time. I'd like to be able to calculate the distance the mouse was moved from one point to another in certain time (one second) and compare these values.

View 2 Replies

ActionScript 2.0 :: Detection Of Mouse Movement Distance?

Aug 12, 2009

how to detect the distance of the mouse movement in a certain time. Id like to be able to calculate the distance the mouse was moved from one point to another in certain time (one second) and compare these values.

View 0 Replies

ActionScript 3.0 :: Getting The Distance Between Two Movieclips' X Value?

Aug 8, 2010

At first it seemed simple to find out the distance between two movieclips' x values, I could have just done:

Code:
mc1.x - mc2.x

However, What I'm trying to achieve is a movieclip of a person climbing an un-even surfaced wall, and to do this I first want to make sure the x value of the person is always equal to the edge of the wall.

How would I calculate the exact position of wall's edge where the person is touching it? I've attached an image to show what I mean.

View 3 Replies

ActionScript 3.0 :: Calculate Distance Of MovieClips?

Apr 8, 2011

I am not sure how to display the distance between the 2 objects on stage dynamically when they are dragged.

View 5 Replies

ActionScript 3.0 :: Calculate Mouse Distance From Multiple MovieClips?

Dec 22, 2011

How can i calculate the mouseX distance from an MC?

i'm using this:

Code:
enterFrame event {
var d1:Number = pi(mouseX,dist0.x);
var d2:Number = pi(mouseX,dist4.x);

[Code]....

View 3 Replies

ActionScript 2.0 :: Movieclips On Same Depth?

Jan 4, 2010

I'm running a loop that's creating a multiple movieclips. Each clip can be dragged to drop point on the screen. What i'm trying to accomplish is when you select an item to drag it should take the highest depth, and should appear over all other draggable items. Right now the first clip is always under all of them while the last is getting the highest.

View 1 Replies

ActionScript 3.0 :: Change Depth Of Movieclips?

Mar 14, 2012

i want when user rollover on any movieclip it comes on top after rollout it goes it's original position but, this code is showing error.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
 
 private function pan3D():void{
excelmc=thumbswork.excel
officemc=thumbswork.office
googlemc=thumbswork.google

[code]....

View 1 Replies

ActionScript 2.0 :: How To Clear Depth Of MovieClips

Dec 29, 2009

This is a bit of a rooky question, probably cos I'm a bit of a rooky, but how do I clear a level, say level 24 of movieclips?

View 3 Replies

ActionScript 3.0 :: Swapping Depth Of MovieClips?

Aug 30, 2010

How do you go about swapping depths in AS3? I've got a movieClip (allContent_mc) that contains a bunch of other movieClips(mc1, mc2, etc.) that expand in size when clicked on. However, when they are expanded I need to make sure that the one being viewed is on top. The control to expand each clip lives within each clip itself. Ideally, when the expand code (below) is executed, I'd like to make sure the clip's depth supersedes all others. I'm keeping all the clips together in one larger clip because the larger clip is living inside a scrollPane component. Pretty sure I'm just not defining the path to the clip correctly.

ActionScript Code:
function goOpen(e:MouseEvent):void{
this.setChildIndex (square_mc , this.numChildren - 1 );[code]...........

View 7 Replies

As3 :: Flash - Swap Depth Movieclips In Fullscreen

Oct 11, 2011

I asked this question yesterday but I found out that my problem is using fullscreen my goal is 2 mc 2 buttons : if btn 1 is clicked mc1 fullscreen and mc2 appears at the right bottom corner on top of mc1 if btn 2 is clicked mc2 fullscreen and mc1 appears at the right bottom corner on top of mc2 stage.swapChildren or setChildIndex is the way but with the fullScreen I had this error appears

[Code]...

View 1 Replies

ActionScript 3.0 :: Collision Detection Between Two MovieClips?

Jun 11, 2010

I am in the process of building a project in which several MovieClips "swim" around semi-randomly, and another MovieClip that appears and expands over the mouse on click alters the frequency of the turns. Do do so, I simply need to change the value of a single variable on the first MovieClip's timeline when the two collide. I am using hitTestObject, but I keep running into errors. The expanding MovieClip does not have an instance name, because it only appears when the mouse is clicked, and quickly disappears.

I am receiving the error 1067: Implicit coercion of a value of type Class to an unrelated type flash.display.DisplayObject My code causing my first MovieClip to "swim" is on that MC's timeline, while the rest of the code is on the main timeline.

View 2 Replies

ActionScript 2.0 :: Nested Movieclips - Event Listeners And Depth

Dec 2, 2005

I have two movie clips. The child movieclip is a button with rollover events which is nested inside the parent. I would like the parent to also have rollover events, but I understand that this is not possible in flash. I am familiar with two workarounds: event bubbling/delegation and the event listeners.

[Code]....

View 7 Replies

ActionScript 2.0 :: Depth Setting - Movieclips Are Being Duplicated Constantly?

Apr 12, 2007

i have a movie clip on the stage, and i need its depth to always be higher than everything, but other movieclips are being duplicated constantly. How do i do this?

View 2 Replies

ActionScript 2.0 :: Implement The Swap Depth Function To Movieclips?

May 30, 2007

im having some trouble when trying to implement the swap depth function to movieclips that have the setmask function implimented to them. the problem is that i can get the swapdepth to work but when the setmask is implimented at the same time the movie clips will not swap depths.

the code that i am using to set the mask is _root.bgmasked.setMask(_root.dragger); this is on frame one in the action/code layer bgmasked is the imaged being masked by dragger.

[Code]...

View 2 Replies

ActionScript 2.0 :: Rollover Movieclips Overlapping Rollover Movieclips Hit Detection?

Jun 6, 2010

Basically what I'm trying to do is build an interface out of a fan of cards. I've got the the whole fan as a movieclip and then individual movieclips of the cards inside that have rollover animations.My issue is the rollover works on the cards arranged behind the cards that have the cursor over, which I don't want to happen.e.g see attachment.here's the rollover actionscript i've got on each card:

onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();

[code].....

View 3 Replies

AS3 :: Flash - Continuous Movieclips With Collision-detection?

Mar 8, 2011

I'm starting to understand ActionScript and getting better with it. However, I'm building a platform game with an unlimited length. What would be the best way to create the "block" the player is jumping on?

Of course collision detection for these movieclips is needed (nicest would be to do it without a giant loop through an array, etc. on every frame). There's probably something like 5 block on the screen at the same time.

View 2 Replies

ActionScript 3.0 :: Collision Detection Among Identical MovieClips?

Jan 7, 2011

is there a way to do collision detection amongst identical movieClips? The movieclips have all been added to the stage from one symbol in the library using AddChild().I've attempted to create 2 different arrays for them and push them into each array as they are added to the stage so that there was a means of comparing them. When I perform the collision detection, Flash thinks that the movieClips are in constant collision with each other!I used trace ("bang") to test the collision, and the output window starts tracing "bang" infinitely and doesn't stop, and none of the movieClips are touching each other.

View 9 Replies

ActionScript 2.0 :: Collision Detection To Be Based On Movieclips?

Dec 2, 2002

Next I'm going to make a game with ball physics on it so if anyone can tell me how to make ball physics with bouncing from angled objects.Also, I need the collision detection to be based on movieclips because I need to be able to modify the levels in the game.

View 14 Replies

ActionScript 2.0 :: Collision Detection Between Two Different Duplicate MovieClips

Apr 8, 2007

I was wondering how to have collision detection between two differente duplicated movie clips. For example, a duplicated bullet hits a duplicated bird, how do I make it so that it detects collision when the duplicated bullet(bullet+x) hits the duplicated bird(bird+x)?

View 3 Replies

ActionScript 2.0 :: Distance From Center - Output Distance Only In Positive Numbers

Jun 17, 2005

I am working on the project where everything is based on the distance from the center of the stage. First I made this fla where flash outputs the x and y distance from the center. First problem is that I want to output distance only in positive numbers.

View 1 Replies

ActionScript 2.0 :: Collision-detection Between Dynamically Named Movieclips

May 25, 2004

I have a movieclip (myMC) that I create several instances of.I dont duplicate the movieclips, but just copy and rename them like "myMC_i", where "i" is a unique number.Can I somehow check if one copy of myMC (for instance "myMC_2") collides with another copy (for instance "myMC_5"), always ignoring collisions with other types of movieclips on the stage?Thats the problem I cant solve. I can either check for a collision with ANY other movieclip, or check for a collision with a single SPECIFIED movieclip (by checking for its name). But I dont know how to check for a collision with a group of movieclips that has the first part of their names in common. If it had been like in a search-engine, you would have been able to search for:[code]

View 1 Replies

ActionScript 3.0 :: Making Distance Between All Mcs At Equal Distance From Each Other On Mouseover

Oct 16, 2010

I am posting my code that attaches the movieclips on stage

[Code]...

i was hoping that when the newMc expands, all other mc would keep the same distance between each other as at initialisation. I not able to figure how to do it. maybe even an earlier post or llink where similar query was explained.

View 1 Replies

ActionScript 3.0 :: Get The Distance Between 2 3D Objects By Using Distance Method

Apr 28, 2011

In AS3 I am trying to get the distance between 2 3D objects by using distance method.
  
if(Vector3D.distance(model.position,model2.position) < 100)
{
// do something

[Code]....
 
>>You can use it directly as a method of the Vector3D class to get the Euclidean distance between two three-dimensional points.
 
Which point does this method pick? Is it the closest point to the other object ?
 
I am just thinking of how much time this would take in testing objects with large poly count.

View 1 Replies

Professional :: Importing Libraries Into FlashCS3 Project

Jun 7, 2010

I have got a little problem with ipmorting alivePDF library into my project. I`v written something like that:[code]Hovewer it doesn`t want to work. I have got those errors:1046: Type was not found or was not a compile-time constant: PDF. var myPDF: PDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );1180: Call to a possibly undefined method PDF.var myPDF: PDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );

View 5 Replies

ActionScript 2.0 :: Flashcs3 AS2 External Swf Will Load But Won't Play

Dec 17, 2008

I am totally new to actionscript.I found a slideshow which uses an xml file to load jpgs. (albumV2.swf)The xml contains jpgs, and captions.When I publish it on its own...works fine.Now I'm trying to place albumV2.swf inside a deeply nested mc.I'm using a button to navigate to the target movieclip (holder_mc) which I want to contain the external swf.[code]when I test The albumV2.swf loads, I can see the background for the photos. But it won't play.There are thumbnails in the swf that don't show, but there's also a timer and counter in the swf that do show.All the photos are called from the xml doc, but I can't see them. However, I CAN see the first caption that's in the xml.doc. and only the first caption.I wondered if the code in the original slideshowFLA uses some hierarchy that I'm screwing up, but shouldn't the xml be fine once it's found?

View 1 Replies

ActionScript 2.0 :: [FlashCS3] Dead Links In Multiple Browsers?

Nov 26, 2008

I am currently developing a banner that contains 4 buttons. Each of these link to different URLs within the website where the banner appears.

The problem:SWF functions beautifully on its own (i.e., animations play, rollovers work). However, when uploaded to the server and dropped into the HTML with the proper plug-ins, the links suddenly cease to function. Flash still plays beautifully - it's just the links that seem to disappear. The one browser where the links seem to work 'as is' is Firefox on PC.

I am using the basic but usually effective:on (release) { getURL("http:url...); }

Sorta-solution: Added "_blank" to the end of the script and this worked in all tested browsers... however, the client wants the URL to open in the same window (they have asked not to provide the actual link).

View 2 Replies

ActionScript 2.0 :: [FlashCS3] Gallery XML With Thumbnails - Return The Id Of The Last Image?

Oct 13, 2009

I have this code and I want that when you click on each thumbnail returns its id (associated with i) but only get to return the id of the last image,

Code:

x = 40;
y = 200;[code]..........

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved