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


Similar Posts:


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

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

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

ActionScript 2.0 :: Enemies On Minimap(radar) And Warping For Enemies

Feb 25, 2010

as from title above, minimap where enemies spawn and can be shown on the minimap and enemies warp like player_mc do. ps: i'm new to this forum. attached files below

View 0 Replies

ActionScript 2.0 :: Make Multiple Enemies That Look Same?

Dec 22, 2010

I just started Flash like 2 weeks ago, so im not very good. Im making a game where you pick a character, and shoot pigs. Every pig you shoot adds 500 points to your score. Problem is only one pig works. If i copy and paste that pig and his code (as2), when i shoot one pig both pigs explode, giving me 1000 points. How can i make it so that when i shoot one pig, one pig explodes, and i get 500 points?[code]...

View 4 Replies

Flash :: Using Multiple Timer To Show / Hide Enemies?

Jul 13, 2011

i have a shooting game that works with some sort of rounds, for instance, this round is gonna show 4 enemies on the screen that the user has to shoot. I show the 4 enemies at a half seconds interval of each one so it doesnt all appear on the same time. Using something like:

enemiesShowTimer = new Timer(0.5 * 1000, 1);
enemiesShowTimer.addEventListener(TimerEvent.TIMER, showEnemyAtTime);
enemiesShowTimer.start();

The player has 2 seconds to kill each enemy after they appear, so i also use this:

enemiesCleanTimer = new Timer(roundConfig.getSecondsPerEnemy() * 1000, 1);
enemiesCleanTimer.addEventListener(TimerEvent.TIMER, cleanEnemies);
enemiesCleanTimer.start();

The problem is, after the player dies i change scene and if i still have like 3 alive, enemies, the threads will try to run the methods and it will crash. I'm using always the same variable to the start the timer whenever i need it. How can i solve this? Will i have to store each "thread" (timer) on a list and then stop each one separately? Because the way it is, the other threads are in some sort of "limbo" and i cant stop then, just the last one.

View 2 Replies

ActionScript 3.0 :: Managing Multiple Instances - Assign The Bullet Speed And Check For The Collisions With Enemies?

Sep 17, 2011

I have been reading these forums for like 2 months, thus i never felt like being able to post something as a valuable answer to someone's problem, since i've been AS3ing for like 3 months now. I have a small problem here on a game that i am trying to create. I am trying to make a shooter game . Like the ones u kill enemies and then the the level advances ( imagine the pseydomovement depth feel of the background giving the player the taste of further movement of the field , yes like old airplane games ). Ok to the point.

1) created a main .as where all the code is running. The movement of the player is written there also. no problem with that. 2) created a bullet class where i assign the bullet speed and i check for the collisions with enemies. the problem occurs somewhere here i have created a statement where every some time ( like 0,5 secs ) an enemy appears and takes a random road till the stageHeight . here is the code .

[Code]...

So when all 5 mikros are out i start firing them . BUT only the last child of mikros seems to follow the hittestobject procedure of my code. Which means that if all of the 5 mikros are on stage the one with the smallest .y value will disappear when hit by "sfera". I know it is huge but this pains my head for like 1 week and i cannot think anything . Tried some staff. but i do not know if this is proper thinking or if my programming is proper for this and i must redo all.

View 1 Replies

Professional :: Writing A Class For Making The 'enemies' Follow The 'player'?

Feb 14, 2011

I'm an actionscript beginner and trying  to write a class to  make the 'enemies' follow the 'player' (shown below). I'm trying to write it such that it takes two MovieClips as arguments, and moves the first one toward the second one. When I import the Class try to use it in Main.as by typing  " var followPlayer:FollowPlayer = new FollowPlayer(fishMov0, player);", I get the following error:
 
"ArgumentError: Error #1063: Argument count mismatch on jab.enemy::FollowPlayer/followPlayer(). Expected 2, got 1."

[Code]...

View 3 Replies

Professional :: Create A Project With Multiple Pages?

Feb 1, 2010

I am trying to create a project with multiple pages.  I stumbled across a tutorial demonstrating how to load and unload swf's.  I used it and it works.  way i could specify a btn or mc in the loaded swf that will specify the "click" area where the unload content takes place?  Right now if i click anywhere on the loaded swf it unloads (i want that to be specified).
 
var myLoader:Loader=new Loader  ();
page1_mc.addEventListener(MouseEvent.CLICK, page1content);
function page1content(myevent:MouseEvent):void {

[Code]......

View 10 Replies

Professional :: Create A Flash Website With Multiple Urls?

Feb 6, 2011

I am not great at flash and am making a website that has a few different tabs for different pages.How do I make different urls for each page?I want to track each page seperately.

View 1 Replies

Professional :: Create A Basic Slideshow With Multiple Images?

Mar 26, 2011

I have Flash CS5 and want to create a basic slideshow with multiple images. how to create a slideshow (must be detailed because I'm new to Flash)?

View 4 Replies

Professional :: Create Multiple Jpg Images At One Time To Symbols?

Dec 20, 2011

Can I create multiple jpg images at one time to symbols in flash?

View 1 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 3.0 :: Put Enemies In An Array?

Jan 3, 2011

I'm making a Space Shooter Game for school and I just can't find how to put my enemies in an array. I found this code in an other thread

[Code]...

So what I need to make is 2 arrays, one arrEnemies where I put my emenies in and the other one arrBullets where the bullets go. Then these 2 arrays do a collision check

View 14 Replies

Professional :: Multiple Buttons Linking To Multiple Pages From One Movie?

Aug 28, 2011

I have a flash movie with 3 buttons I am trying to link relativley to pages within my site, I have one working fine but can't get the others to link and when I try it makes the one that is working, work no more..

Below's the code I am using for the one that is working;

import flash.events.MouseEvent;var getIndex:URLRequest = new URLRequest("../index.html");
//---Enter Button---\

[Code]....

View 5 Replies

ActionScript 1/2 :: Distant Enemies Dont Appear?

Aug 31, 2011

i will explain my problem according the 11th enemy (the last enemy in the level). i past here the answers i gave to people fron other forums..I'm making a platform game, and i have a problem. i am attaching 11 enemys, and my last enemy not appears. the _X of the 11th enemy is 3300.I  tried a lot of stuff, and think, I discovered the source of the problem.on my hero class i wrote this:
 
_root._x -= (_root._x + (_x - 275)) / 5;

and when i changed it to this:

_root._x = -_x;

the last enemy appears!but i want it to be like first one.but it doesnt work.also, i found that if i placed the hero close to the last enemy, the last enemy appears.the _root._x refer to the stage and the _x refer to the hero.i found that if i remove this code(the gravity in the enemy class):

_y += grav;
grav += gravity;
while(ground.hitTest(_x, _y, true)){[code]....

View 1 Replies

ActionScript 1/2 :: Spawning Enemies Loop?

Feb 16, 2012

im making a script where it spwans enemies when the enemy count is lower then or equal to the CurrentEnemys.
but it spawns like 200 enemys and says the function is looping and my CurretEnemys trace says NaN..
 
Hers the script.
 
enemyCount = 0;
CurrentEnemys = 5; 
function startwave(){

[code]....

View 7 Replies

Professional :: Copy Multiple Object On Multiple Layer With ALT?

May 27, 2010

In version before flash CS5, we could copy multiple objects from multiple layer by just click and drag + ALT, that was really usefull and it becames vital for me. Now in the CS5... the click and drag + ALT on multiple objects from multiple layer is copying all objects to only one layer !

View 3 Replies

Professional :: Drop Multiple Images In Multiple Frames

Aug 22, 2011

I have 260 images that I need to place on different frame. Instead of dragging them one by one the image on the stage, is there a way to drop all of them in one shot but each images is on a different frame?

View 3 Replies

ActionScript 3.0 :: Creating A Enemies Killed Counter?

Mar 20, 2009

Everytime a monster dies, I want the monsters killed dynamic text field to increase the number by 1. I gave it a good shot but it feels like im missing something basic, Im fairly new to this still but picking it up quickly. The following code is inside of a movieClip dealing with the monsters. The second block of code is on my main timeline.

Quote:

import fl.motion.Animator;
import fl.motion.MotionEvent
var this_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>

[code]....

View 2 Replies







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