ActionScript 2.0 :: Having Multiple HitTests With Same Movieclip?

Apr 29, 2010

I'm currently programming in AS 2.0, and I'm trying to get a piece of code to work. I have a movieclip that is deployed when the user clicks a mouse button, sort of like a bombshell being dropped on an area.

However, when I run it, it's quite obviously only registering one of the hitTests, because _parent.sprite_counter only decrements by one, regardless of how many enemies are destroyed. That's the other weird thing; no matter what, even if the counter never decrements, the movieclip still is removed.

Is it because you've got several movieclips simultaneously trying to decrement the same variable?

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Looping Through Multiple Hittests

Dec 5, 2009

I have many, potentially hundreds, of objects that are floating around the screen. These objects are named "Object1", "Object2", "Object3" and so on. Another object is moving around the screen and if it hits any of the other objects, it destroys them. The thing is, if I have a loop like:

Code:
for(var i = 0; i < ObjectCount; i++)

where ObjectCount is subtracted off each time an Object is destroyed. Now say Object1 is removed, then the loop will fall short and not check for a collision for the Object with the highest number. The way I am dealing with this at the moment is I am looping through the initial number of objects and not subtracting off ObjectCount, so when there is only say 10 of an inital 100 objects left, it is still looping through all 100.

Here is what the principle of it is:

Code:
for(var i = 0; i < ObjectCount; i++)
{
CurrentObject = GameArea["Object"+i];

[Code]......

And as you can see, if Object1 is removed, then the Object with the highest number on it will not be checked.

View 3 Replies

ActionScript 2.0 :: Mx2004 Multiple HitTests

Sep 14, 2004

I have 9 static movieclips arranged in a 3 by 3 grid, and 1 movieclip that moves using keypresses (invisible_mc)[code]when a hitTest is registered between the invisible_mc and any of the icon_mc's, The icon_mc goes to and stops on frame 2..else it goes to and stops on frame 1. I have constructed the hitTest as follows.is there anyway to reduce the endless repetition of code? [coe]

View 1 Replies

ActionScript 2.0 :: HitTests On Multiple Objects?

Apr 9, 2005

I have a bullet movieclip and it moves. I've put a hitTest on its onEnterFrame so that it checks if it hits its target, whose instance name is mmbug and the target flies around. That's easy and works cool.[URL]there's only one wasp present at a time and it works)Now what I want to do is duplicate the wasps so there are more flying around at one time, but how would I do the hitTest on the bullet then, because you have to specify it an exact instance name. If I make all the wasps have the same instance names it doesn't work.So obviously I'd have to give them names of mmbug1, mmbug2, mmbug3 etc. But how would I check on the hitTest if it hits any of them, since you have to put in an exact instance name in the hitTest?

View 5 Replies

ActionScript 3.0 :: How To Handle Multiple Hittests

May 24, 2009

I've been reading up and looking at examples of how to handle multiple hittests. So far in my example I have failed.

[Code].....

Basically I want to be able to check for a hitTest against all the bullets on stage against all atoms created. I attempted to do this with two for loops and it didn't work

View 4 Replies

ActionScript 2.0 :: HitTests On Multiple Objects

Apr 9, 2005

For instance, I have a bullet movieclip and it moves. I've put a hitTest on its onEnterFrame so that it checks if it hits its target, whose instance name is mmbug and the target flies around. That's easy and works cool. ( see [URL] , there's only one wasp present at a time and it works) Now what I want to do is duplicate the wasps so there are more flying around at one time, but how would I do the hitTest on the bullet then, because you have to specify it an exact instance name. If I make all the wasps have the same instance names it doesn't work. So obviously I'd have to give them names of mmbug1, mmbug2, mmbug3 etc. But how would I check on the hitTest if it hits any of them, since you have to put in an exact instance name in the hitTest?

View 5 Replies

Professional :: Create Multiple Enemies And Be Able To Do HitTests Against Them?

Oct 12, 2010

i got this flash with duplicated mc's say...enemy1, enemy2, enemy3. now we all know we can do something such as..
 
if {_root.blah.hitTests(_root.enemy)){_root.enemy.nextFrame();}}
 
because the enemy is duplicated and its no longer "enemy" but enemy12 or ****.is there any way to ...create multiple enemies and be able to do hitTests against them somehow.Also im not really a fan of attachMC

View 5 Replies

ActionScript 1/2 :: If Multiple Hittests Equal True, Go To And Play Next Frame?

Dec 7, 2009

I am trying to finish up a project and run into this problem, right now I am trying to create a drag and drop game and on the last game you can dropparts into the others, what I want to happen is that when all are in the correct spot gotoandplay next frame. This is my current code,

if(one_mc._droptarget=="/onedef_mc" && two_mc._droptarget=="/twodef_mc" && three_mc._droptarget=="/threedef_mc" && four_mc._droptarget=="/fourdef_mc" && five_mc._droptarget=="/fivedef_mc" && six_mc._droptarget=="/sixdef_mc" &&

[code]....

View 9 Replies

IDE :: Movieclip HitTests On Particular Layers Of A Movieclip?

Mar 19, 2010

I'm working on a game project for school and I'd like to cut down the amount of library items I'm going to have to make for each level (I have a clip for unwalkable areas, places where shots can impact and so on.) Is there a way I can just draw one movieclip per level and cut up its parts into different layers, then call hittests on just specific layers instead of the whole movieclip?

View 3 Replies

ActionScript 1/2 :: Hittests For Mcs Inside Other Mcs?

Aug 5, 2010

I have a hittest code that's supposed to prevent an mc from moving into a space occupied by another mc. The thing is, the first mc is inside another mc and for some reason the hittest isn't registering. The code I'm using is below. Is it wrong somehow, or is there another code I should be using?
 
Key.addListener(keyListener);
this.onEnterFrame=loopF;
function loopF() {

[code]...

View 3 Replies

ActionScript 1/2 :: HitTests Dont Work ?

Aug 7, 2011

Ive got this script. when u press a button u can create a movie clip called man. when u press another button u can create one called enemy. thay both create at different sides of the seane and thay walk past each other.but when thay touch each other thay should go to frames inside them. ect Attack,Die.

var mans = 0;
function addman() {
if (Gold>=10) { [code]....

View 4 Replies

ActionScript 2.0 :: Curved HitTests For Flash 2004 MX?

Aug 16, 2006

how do you make a curved/slanted hitTest?

View 1 Replies

ActionScript 2.0 :: Movie Clip Hittests Anything On The Screen?

Jun 15, 2007

Is it possible to check if a movie clip hittests anything on the screen?

View 1 Replies

ActionScript 2.0 :: [flash Cs4] Arrays And Hittests Not Working?

Sep 2, 2010

My fish is swimming along and needs to catch the food and avoid the poison. I've attempted to create arrays for the food and the poison so they are randomly dropping down. I've also added a hittest but can't get it to work.

I'm not really happy with the randomisation of the array, there are too many instances appearing on screen and I'm not sure how to fix this. Is there an easier way to animate the food dropping down without using as2 and arrays? There is also something wrong with my score, each food should be +10 to score and poison should be -10, but that doesn't seem to be working either. I also don't know what script to type to end the game to either a congratualtions screen or game over screen. Basically I have no idea what I'm doing and haven't had much help from my teacher, he may as well be speaking another language.

View 2 Replies

ActionScript 2.0 :: Duplicating Movie Clips, Loops And HitTests?

Mar 18, 2010

I'm creating a simple game called shape wars. The game is shooting game where a blue cube(the player) fires blue shapes at the enemy(the red cube). The red cube also fires red shapes at the blue cube.Here is my code for duplicating the red shapes (this code is contained within the enemy)

onClipEvent (enterFrame) {
//attack
att = random(6);
if (att == 1 && dead == false) {
_root.redBullets++;

[code]....

View 2 Replies

ActionScript 1/2 :: Multiple Draggable Movieclip Within The X And Y Axis Of Another Movieclip

Mar 19, 2012

I have this four draggable movieclips. I have able to drag the green bar within the gray bar and the dynamic percentage text increase/decrease accordingly.

The program should make the second draggable determine the percentage of the first (100 - current value) and make it the basis for the other 3 draggable.

Example:
 
if the 1st draggable will be 75%. the other 25% will be divided by the other 3 draggables.

The 3rd draggable determine the 2nd percentage (100 - current value) and make it the basis for the other 2 draggable and so on.
 
When I drag the 1st draggable the other 3 is drag & animated accordingly but I cannot drag the 2nd, 3rd and 4th draggable.

View 1 Replies

Lag On Multiple Movieclip Switches?

Feb 22, 2011

I am thinking there is a easy solution to this, but the more button clicks and the quicker button clicks between my 3 buttons (which load a movieclip each time), the "laggier" the SWF gets. [code]...

View 1 Replies

ActionScript 3.0 :: Using 1 Movieclip In Multiple Swf's?

Dec 21, 2011

I was wondering if it is possible to have a movieclip that you can like export and then share in multiple .swf files. This, without importing them from external libraries in the .fla files afcourse. So like i have a movieclip containing different type tile bitmaps (i do that why im asking) I use these tiles in the editor and in the game .swf; Changing the(adding to) graphics has me importing the mc from from one .fla into the other. Is it possible to make mc in a .fla, export it and dynamicly import it? Or can I read the library from the other .fla dynamically?

View 5 Replies

ActionScript 2.0 :: Multiple Movieclip Bug?

Jan 4, 2007

TheCanadian helped my figure out my code here yesterday and now I am having another problem.I have a parent MC (legend) that usees a button action and child MC's inside that has actions as well. I have multiple parent MC's (not just legend....legend1,legend2,etc). How do to duplicate this code to work for each? I tried copying and pasting the code and changing legend to legend1 but, it does not work correctly then. When I rollover one MC, one or all will alpha fade up as well.how I can get this code to work on multiple MC's on the stage?:

Code:
#include "lmc_tween.as"
//legend
legend._alpha = 10;
legend.over_mc._visible = false;

[code]...

View 6 Replies

ActionScript 3.0 :: Create A New Movieclip From Multiple Other Ones?

Jul 8, 2011

Basically, on my stage, the user can select a bunch of different weapon parts and each 'part' has its own movieclip. Once the user has customised a full weapon, I need to give them the ability to convert the entire array of parts into a single movieclip so that I can then use that generated weapon (move it around in a game) without moving the individual parts around.

View 2 Replies

ActionScript 3.0 :: Multiple Instances Of One Movieclip?

May 3, 2011

I'm trying to do a drag and drop game, where I have to drag the same movieclip several times...

View 12 Replies

Actionscript 3.0 :: Multiple Instances Of Same Movieclip?

Jul 17, 2011

I've built a dropdown menu movieclip that I need to use in a contact form- or more specifically, I need 2 dropdowns with different options in them in the same form. My problem is that when I change the properties in one instance of the dropdown_mc, it changes the properties in the other as well. The two clips have different instance names, and I've been changing labels of the list items by clicking through to the actionscript imbedded in each dropdown (not through the dropdown_mc in the library). There must be an obvious solution to this that I somehow didn't catch....I've even tried dragging each dropdown from the stage back into the library and creating a new movie clip with a different symbol name and they're still connected. Do I need to create an entirely new copy of this dropdown with different instance names

View 1 Replies

ActionScript 2.0 :: Loading The Multiple Swf's In One Movieclip

Sep 8, 2005

In my website,click the menu button the corresponding text and image view in the stage.But upload the site in server side image appears after few minutes of the text appears.the problem is how to appear the image

View 1 Replies

IDE :: CS5 Working With Multiple Instances Of A Movieclip?

Jan 17, 2011

I am working on a project which looks like a crossword puzzle. When you mouse over on the white boxes they will light up. When you mouse over the letters they will have 3d rotations and when you rollover only some specific letters, they will flip some specific boxes.

Right now what happens is, when you mouse over the boxes with letters on them, the letters will rotate but the box will not light up. This is because I have created the box movieclip, with the invisible button inside it, and then just duplicated it in my scene to create a tile. But the invisible button for the letters are on the scene,so it's kinda overriding it.when I tried having the buttons on the scene rather than inside the movie clip, what happened is when you roll over one of the boxes, all of them will animate.

View 1 Replies

ActionScript 3.0 :: Add Multiple Instances Of A Movieclip Via It's Linkage?

Mar 14, 2011

how to add multiple instances of a movieclip via it's linkage...

this is the script that adds a single instance to the stage.

code: package
{
import flash.display.MovieClip;
import flash.events.Event;

[Code]....

View 2 Replies

ActionScript 3.0 :: Creating Multiple Instances Of One Movieclip?

Feb 12, 2009

I'm having trouble creating multiple instances of one movieclip. I've got an array set up that loads photos into flash and places them in a grid (sort of). I want those photos to have outlines around them. So, i created an outline. Now, when i try to place it on all of the photos, it will run through them and only apply itself to the latest photo (one instance overwrites the others). How do i make multiples of the outline?

View 1 Replies

ActionScript 1/2 :: Loading Multiple Images Onto One MovieClip

Jul 17, 2009

I was wondering if there is a way to load multiple png files onto one movie clip without the images overlapping? I'm currently I am creating multiple movieclips for different images and I think I reached the level limit that the flash player can handle, because I have other layers in the timeline whiting out after everything loads.

View 1 Replies

ActionScript 1/2 :: Applying Multiple Instances Of Same MovieClip

Aug 27, 2009

I have the following code on frame1 of my movie that I want to apply to multiple instances of the same movie clip:

mainClip_mc.subClip1_mc.specifiedClip_mc.onPress = function () {
//code begins
SpecifiedClip_mc exists in subClip1 through 4. Is there a way to do this once without having to say:
mainClip_mc.subClip2_mc.specifiedClip_mc.onPress = function () {
//same code
mainClip_mc.subClip3_mc.specifiedClip_mc.onPress = function () {
//same code
mainClip_mc.subClip4_mc.specifiedClip_mc.onPress = function () {
//same code

Essentially, specifiedClip_mc's parent clip is what's throwing me here. The code to be applied to specifiedClip_mc is identical and I'm not going the correct route by doing this the long repetitive way.

View 3 Replies

ActionScript 3.0 :: Converting A Movieclip To Multiple Movieclips

Nov 20, 2009

I have a movieclip of height say 2000px, I want to break it into 4 Movieclips of height 500px each. How can I do that?

View 5 Replies

Flash :: Multiple DrawPaths On Movieclip XOR Instead Of Additive?

Dec 11, 2011

I have a mask on a movieClip, and I want the player to be able to move the mouse to uncover the movie clip. How do I make the multiple paths on the mask add together instead of interfere with each other?

var maskObj:MovieClip = new MovieClip();
pScalp.mask = maskObj;
//function on user input

[code].....

View 1 Replies







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