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


Similar Posts:


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

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

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 2.0 :: How To Make Random Enemies Spawn

Jan 18, 2011

can anyone give me any idea on how to make random enemies spawn with this code? The export is evil, for the enemies. I've tried a random function but it just doesn't work. Can anyone take this code and make enemies spawn randomly? Like can anyone actually modify it and the put it in their reply?Also, I don't care whether the enemies come from vertical or horizontal directions. The size of the flash is 550 x 400.[code]

View 1 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

Make Enemies Spawn From All Sides Anywhere On Side Like In Amorphous?

Aug 3, 2009

I am wondering how I can make enemies spawn from all sides, anywhere on the side, like in Amorphous or Endless Zombie Rampage 3.

View 2 Replies

ActionScript 3.0 :: Make Certain Type Of Enemies Appear At A Certain Time / Position?

Aug 12, 2009

I'm trying to make a game in actionscript 3, problem is.. now i have made a few enemies inside movieclips, with there own actions inside the movieclips. and i'm not sure how to call them on to the stage to appear at a certain time and location.[url],...

as you can see.. the enemies appear in a pre-deterined order.. which is like most games, and i wanted to know how should i proceed to do that?

should i make an array of enemies, then store another array with the type of enemy inside, location, and time it appears?

then how do i call them sequentially onto the stage?

View 1 Replies

ActionScript 2.0 :: Make Enemies Enter The Stage From Random Directions?

Apr 30, 2008

I'm making a game and need to know how to make enemies enter the stage from random directions, and then move around the screen randomly aswell.

View 1 Replies

ActionScript 3.0 :: Working On A Basic, Horizontal Shooter Platform Game - Make Enemies Move Smart, Towards The Player?

Oct 3, 2011

i am an newbie as3 developer, and i am working on a basic, horizontal shooter platform game.and my question is: how can i make enemies move smart, towards the player? ( but ofcours you are in able to dodge)so like, an enemy is moving to me so when i am not dodging, it will hit the player.

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

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

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

ActionScript 3.0 :: Rotating Enemies Along A Curved Surface?

Apr 14, 2009

This one concept has been bugging me for days now and I can't seem to solve it. You see, I'm trying to rotate my enemies along an uneven surface. So far, they follow along it perfectly, using my hitTestPoint collision checks.But I don't know how to rotate the collision points and thus rotate the movieclip along the curve so it remains clipped to the ground like in Fancy Pants Adventure 2 or a tanks game.Here is what it looks like right now

View 3 Replies

ActionScript 3.0 :: Refer To A The Value Of Enemies 1 Through 4 With The One Trace Line

Jul 19, 2010

I want to refer to a the value of enemies 1 through 4 in this script with the one trace line, so it will trace,"this is enemy1", "this is enemy2", etc., but I don't know what to write exactly after trace.

[Code]....

View 3 Replies

ActionScript 1/2 :: Making Enemies Collide With Eachother?

Jun 8, 2007

I've got a function here that spawns an enemy for me and I'm calling it in a loop every few seconds or so that it creates a new enemy every second. This all works great.What I want to do though, is to make the enemies collide with each other. How would I go about doing this? I've tried using hitTestm but it detects that each enemy is hitting itself which is always.I've attached my code.

View 2 Replies

ActionScript 2.0 :: Defense Game - Randomize Enemies?

Oct 6, 2007

I'm making a little tower defence game but i've run into a problem;I need a code to randomise my enemies (like in which direction they come from, and how many come)

View 1 Replies

ActionScript 3.0 :: Platform Game 0 Can't Get Enemies To Face Hero

Nov 24, 2010

I'm making a platform game. The hero can move around, but the enemies are stationary. My problem is that I want the enemies to face the hero. The first enemy behaves correctly, but the subsequent enemies only behave correctly if I kill all the preceding enemies. I have added the hero and the enemies as Objects and put the enemies into an array called enemies. Both the hero and enemy objects have a direction property and an mc property that refers to their movie clips. This for loop gets called every frame.

for(var i:int = 0; i < enemies.length; i++)
{//face hero
if(hero.mc.x < enemies[i].mc.x) enemies[i].direction = -1;
else if(hero.mc.x > enemies[i].mc.x) enemies[i].direction = 1;
enemies[i].mc.scaleX = enemies[i].direction;}

View 4 Replies

ActionScript 3.0 :: Enemies Not Being Removed From Stage When Clicked On With Mouse?

May 17, 2011

I have ran into another problem, I have written the code for when I click on an enemy, it doesnt add a point to the score and it doesn't remove the enemy, I have a textfield which is called messageDisplay which is linked to the clickEnemy function.Here is the piece of code.
 
 stage.addEventListener(MouseEvent.CLICK, clickEnemy);                function clickEnemy(event:MouseEvent):void                {                if(cursor.hitTestObject(enemyAppear))                    {                        score++                        messageDisplay.text = String(score);                        enemyAppear.parent.removeChild(enemyAppear);                    }                }                stage.removeEventListener(MouseEvent.CLICK, clickEnemy);

View 2 Replies

ActionScript 3.0 :: Removing Dead Enemies From An Array Upon Gameload

Jun 4, 2011

I am trying to implement saving and loading and it went well until I encountered my arrays of items that can be picked up and put in the inventory, as well as enemies that needs to be removed from the stage upon load if they were dead when the game was saved.I have tried adjusting many different attempts which I found on the internet which were related to my issue, but none of them seemed to work. The last was based on creating a new array and adding enemies to it when they die and in some way splice the enemy-array upon load with the dead enemies. But I am not completely sure of how this would work whichi is probably why I didn't manage to make it work. Here is a link to my mainclass AS3 file: [URL]

View 10 Replies

Flash :: Spawn Enemies From Left And Right Side Of The Screen?

Nov 10, 2011

My character is spawned in the middle of the screen, and i'm not sure how to make zombies spawn from the left and right side of the screen, and moving towards the middle. My goal is to make the zombies spawn automatically, and the character in the middle is able to shoot them down. I've just started working on AS3, but i know that i'll need to make an array to do this, but not sure how to implement this.

Here is my code:

package
{
import flash.display.MovieClip;
import flash.utils.Timer;

[code].....

View 3 Replies

ActionScript 2.0 :: Pausing A Function - Enemies To Stop Moving?

Mar 1, 2006

I'm making a game where if you hit something, an .swf appears over the game. During this time, I want the enemies to stop moving. The enemies are set up to move randomly onEnterFrame. I've tried deleting the onEnterFrame, but it doesn't appear to be working.

View 2 Replies

ActionScript 3.0 :: Flash Platform Game Random Enemies?

Feb 22, 2011

we just recently defended our graduation project which is a platform game like mario. one of the modifications suggested by our panelists is to make level 1 generate random places for enemies and coins after one of them said that mario was a stupid game because you already know where the enemies are, the powerups, etc. i said i'll give it a go and see what i can do. but recently i realized that i havent played any platform game that generates random places for the enemies, coins and other objects. it is only in rpg games like ragnarok that i have seen enemies spawning at random places.

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

Flash :: Tower Defense - Detecting If The Bullet Hits The Enemies

Apr 22, 2011

I am creating a tower defense game and I want to make a tower that shoots a bullet and every enemy that the bullet hits is damaged. The bullet can hurt multiple units. My problem is detecting if the bullet hits the enemies. Right now, I have the enemies in an array. With other towers, when an enemy is in range, the tower fires and when it hits its original target, it causes damage to that target.

For the tower I want to make, it will shoot the bullet the maximum range every time and I need it to damage every unit it hits on the way to that final destination.

View 4 Replies

ActionScript 3.0 :: Way To Show 'enemies' On Random Base On Platform Screen

May 17, 2010

I'm getting an error: [code]I'm also looking for a simple way to show my 'enemies' on random base on my platform screen. I already made an array with the x and y coordinates but I don't know how to make AS3 print them on a random way on the platform windows.

View 4 Replies

ActionScript 2.0 :: Game Project - Placing Unique Instances Of Enemies On Screen

Mar 23, 2010

I've been working on a uni project. Basically, enemies are placed on the screen using a timer variable and using the attachMovie to put them on the screen. This is an example of the code I'm using:

Actionscript Code:
var enemies;var timer;
function onLoad(){
enemies = [];
timer = 0;}
function onEnterFrame(){timer++;
if (timer == 10) {
Timer = 0;
var enemy = _root.attachMovie("mc_1", "mc_1",
_root.getNextHighestDepth());
enemies.push(enemy);
}}

This works and places them on the screen, (and into the array) but by putting them into the array, I thought that each one would be a unique instance of the movieclip which doesn't always seem to be the case. If I shoot one of the enemies, sometimes another enemy will explode (or both of them) and other times I will knock into one enemy and another one will be the one who get's knocked.

For my collision code I'm using this:
Actionscript Code:
for(var i in _root.player.enemies){
if (some arguments..)
_root.player.enemies[i].health -= 10;
}}
The explosion code also uses a similar for loop. Should I look at another method to place unique instances of the enemies on the screen?

View 3 Replies

ActionScript 2.0 :: When Trying To HitTest Bombs With Boundries / Enemies Inside Of 'world' Movieclip

Jun 5, 2006

URL...The game has a helicopter centered on the screen (the heli movieclip is in Scene 1, frame 1, Layer 2). Then I have a "World" movie clip on Layer 1. Inside the world movie clip are the enemies, weapons, and boundries of the map.The world movie clip is moved when the controls are used to make it look like the helicopter is moving (although it is actually stationary). When the space bar is pressed, the "bomb" movieclip inside of the "world" movie clip is duplicated, and the duplicate is placed at the correct coordinates in the "world" movieclip so that it seems like it is coming out of the helicopter. This is all working as intended.The problem comes when trying to hitTest the bombs with the boundries/enemies inside of the "world" movieclip. The "boundry" movieclip is also inside the "world" movieclip, and is part of the Boundry class. The hitTest is inside my "bomb" class. Heres the code:[code]But the hitTest just doens't work. I've tried every combination of legal hitTest statements between the two movieclips, and it wont work. As you can tell from the SWF...the bombs explode seemingly randomly. SO somewhere...somehow...the bomb is colliding with the boundry.

View 1 Replies

ActionScript 3.0 :: Chasing Hero Game Character As A Square And The Enemies Are Circles At The Moment

Sep 11, 2009

i am making a game and i have my main character as a square and the enemies are circles at the moment. i have just made the circles home in on the main character, but my problem is when the enemies come inline with the x or y coordinates of my character they start vibrating/shaking. im not sure how to fix this. i have included my fla so you can easily see whats going wrong.

View 1 Replies







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