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


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

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

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 2.0 :: If () Dont Get It?

Jun 17, 2005

I am a PHP programmer who wants to combine PHP with Flash. I work with Flash 2004 MX.My question is:I have a PHP script who sends a variabel back to Flash named: validI have the folowing code but this does nothing.....it is like the value valid is lost. Flash code:

Code:
oadVariables("../PHP/login.php", "/", "GET");
if (valid=="ok"){

[code].....

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

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

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 :: 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 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

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 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 :: 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

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

F8 Buttons Dont Work Anymore

Dec 6, 2009

Im very new to flash and a colleague provided me with perfectly functioning swf presentation. I opened it with flash to make some minor mods and now when i save the pause/play buttons he had put on the presentation no longer work no longer work.

View 1 Replies

Flash :: Certain Fonts Dont Show Up In IDE?

May 15, 2009

Windows XP - Flash CS3: I have a family of fonts installed on my sytem, all Printer Font Metric (.PFM), Flash IDE only shows 2 of the 4 Do I need to use/convert to OpenType fonts for universal compatibility?

View 1 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 3.0 :: AddChild Dont Work?

Feb 21, 2010

I'm trying to use addChild in a for loop to add lots of copies of one mc, but they are not appearing on the stage.

[Code]...

View 3 Replies

ActionScript 2.0 :: MovieClips That Dont Exist Yet?

Nov 2, 2007

Im building a preloader queue thingy and i have one big problem.

firstly - the goal of this class is the possibility to add movie clips to the queue that arent yet loaded in by their parent movie clips (which are also in the queue). this is a very important function of this object, and one of the main reasons im coding it.

so - when i pass a reference to a MovieClip Object to my addToQueue function, if the movie clip exists, all is well and good. But if the movie clip happens to be a child of another movie clip that is in the queue, it doesnt exist yet - so the reference returns "undefined" as expected.but very soon into the queue processing function, the child movie clip will come into existance, but unfortunately that doesnt matter cause initially the movie clip wasnt there, so the pointer variable still is set to undefined....

how do i store a pointer to a movie clip that doesnt exist YET but i know will exist? i want to be able to pass a reference to any movie clip in any scope, possibly as a child of many parent movie clips that may or may not exist...is there a sure way to set up a variable to reference a movieclip so i can use it, for example, in loadClip() functions, when the movieclip does actually appear? even if it doesnt exist yet?

View 5 Replies

IDE :: (Trace MC Name) ButtonSix Dont Wok Correctly?

Jan 13, 2009

All trace functions below work except for the last, buttonSix. The code, unless I'm missing something blatent is exactly the same in each else statement, and the MC is labeled correctly.

Code:
var onStates:Array = new Array(buttonOne, buttonTwo, buttonThree, buttonFour, buttonFive, buttonSix);[code]......

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







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