ActionScript 3.0 :: Making References To All The Subclips In The Enemy Animation And Holding?

Jun 7, 2009

Recently I've been developing in a certain way that i'm not sure is wise, so I thought I would ask the guru's here for guidance. Let's say I'm developing a game with an "Enemy" class. Recently I've been making references to all the subclips in the Enemy animation and holding them in my class as variables, so for an Enemy called "Troll" i might have variables in the class saved as:

private var _walkAnimation:MovieClip;
private var _runAnimation:MovieClip;
private var _attackAnimation:MovieClip;

and then reference these whenever I need to flip between the animation states for that Enemy instead of using getChildAt() or getChildByName() to find the relevant subclip every time I wanted to reference it. I was once told saving CPU was more important than conserving memory in cases such as this, but I wanted to make sure this was true. Your thoughts?

(I call a dispose() or destroy() function when I remove enemies so the references can be Garbage Collected)

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Making An Enemy Follow The Player?

May 27, 2010

I've been working on a game for my AS3 class that involves enemies randomly spawning from all direction and following the player in an attempt to collide with him. I can get the enemies to spawn from one direction as well as move in a single direction but I can't get the spawning from all sides or the following the player around to work.

I've been at this for a couple of weeks now and followed several suggestions and tutorials (including one from here) with no success and this thing is due by tonight . Here's the code from my enemy class. All of the code of the game is done through AS files with no coding done within movie clips or on the timeline.

package
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;

[code]....

View 14 Replies

ActionScript 3.0 :: Making Game - Zoom In And Out By Holding And Letting Go Of The Space Bar?

Dec 28, 2010

I am making my first game and it's my first time using actionscript. I am making a sniper game themed with the L96A1 sniper rifle from COD: Black Ops and the map nuketown. I'm in cs5 with ac3 and on my stage I have two movie clips that I'm working with. I'm not really sure if they're supposed to be movie clips though. Anyways, one is the gun, and the other is the zoomed in scope overlay thingy.

For now, I'm trying get the zooming in to work. I haven't done anything else though except collect graphics for enemies, the landscape, the gun, and the scope. I want to make it so that you zoom in and out by holding and letting go of the space bar. Also,I want to make it so that when you are not zoomed in, the gun moves horizontally at the bottom of the screen (aligned vertically with the cursor). And when you are zoomed in, the scope crosshair is the cursor.So my idea was to set the gun as the cursor and make it only move horizontally at the bottom of the stage and then make an event listener that listens to when the spacebar is pressed and when it is, disables the gun as the cursor (and makes it transparent to get it off the screen) and makes the scope the cursor [was transparent, now opaque and unrestricted(vertical movement also)].

I got as far as making the gun move horizontally at the bottom with the cursor. I cant get the event listener working because I don't really know how to go about changing the opacity of each movie clip and how to switch cursors. So I am asking how do I change the opacity and switch the cursors when the spacebar is held and then reverse those changes when the spacebar is released? Here's my code on an "actions" layer [I haven't done any animations yet, so everything is on frame 1. Also, I used a couple preset code snippets since I have no previous experience with actionscript (I can understand most of it though)]:

Code:
import flash.events.KeyboardEvent;
// make gun cursor
stage.addChild(gun);[code]..........

Here's a link to a zip archive with all the files used so far (I hope this google docs link works): link

View 2 Replies

ActionScript 3.0 :: Enemy UI - Move To X And Y (Animation)

Jan 4, 2010

I've been trying to make my somewhat first game, and got stuck. Trying to make the "Enemy UI".
You don't need any background info.
Enemy is at 100X and 200Y.
Make him move to 350X and 50Y. ( in a somewhat animation )

So I was thinking, check if Current X is smaller or bigger than 350, then every frame (or by Time Animation ), do x++ or x-- Accordingly.
Same for the Y.
Is there a better way to it? Something that will make the animation smoother? A way that's better, can be "upgraded" in the future?

View 4 Replies

ActionScript 3.0 :: For Loops And Arrays - Run The Specific Animation Of Enemy

Oct 31, 2009

how can i find out from a for loop that which object from the array has been hit; For eg - i have 2 enemies in an array and i run a for loop

[Code]..

View 2 Replies

ActionScript 1/2 :: Plays Random Animation The Enemy Is MovieClip Who Contains Other MovieClips?

Sep 11, 2011

I am creating a game and I want that when the enemies started to attack me, I want it to plays random animation(the enemy is movieClip who contains other MovieClips )

View 6 Replies

ActionScript 2.0 :: Movieclip - When It Hits The Enemy, It Goes To The Enemy's Second Frame?

May 31, 2004

i have one movieclip and i have another movieclip>enemy...okay so when the first movieclip goes over the enemy, nothing happens until i roll out! all i want to do is the movieclip, when it hits the enemy, it goes to the enemy's second frame and that's it ! there are no syntax error in this script, just something i want to do that apparently doesn't work right.here is my code:

Code:
onClipEvent (load) {
speed = 2;[code]...

View 14 Replies

ActionScript 2.0 :: Enemy Attack - Make The Enemy Pause When It Reaches The Character, Then Choose An Attack To Use?

Mar 18, 2006

I am currently making a game, similar to StreetFighter,where enemies will come on from the side and you fight them. Now i have the character movement and attacks fully scripted, and have made an enemy, and i make it move towards the character using:

onClipEvent(load){
movethy = 7;
scale = _xscale;[code].....

Now this works quite well and the enemy stops when it hits the character, but the problem is, it wont complete a full attack, instead it plays a few frames of the attack MC. Now i have every attack in a different MC (Frames 2-5) inside the Enemy MC. How can i make the enemy pause when it reaches the character, then choose an attack to use? From there i'll be on my way and can script the hittest and so forth.

View 2 Replies

ActionScript 2.0 :: If Hit The Enemy Ball (instance Name Is "enemy") It'll Disappear?

Mar 28, 2008

I have a ball (instance name is "ball") and if I hit the enemy ball (instance name is "enemy") it'll dissappear, and add 100 points. At the same time, I want them to multiply and get faster.The enemy has a follower code:

onClipEvent (enterFrame) {
if (_root.ball._x>_x) {
_x += 2;[code]....

And the ball has a code that is secret because if I give it to you it'll spoil the game idea.The dynamic text box has an instance of "points".I have my mute sound control done and the ball you control done.

View 2 Replies

ActionScript 2.0 :: Remove Subclips Of Clip

Mar 11, 2004

I have a movieClip on stage _root.myClip. I have attached several clips to this clip. Now after some random amount of time I need to remove all these clips. One catch though I can't remove the original clip and I dunno if its a good practice to store movieClip references in arrays for later retrieval cause there are gonna be around 1000+ subclips at any given point of time. (This is the logic so I cant change that)I have also tried for-in loop but it doesnt work for me. I doesn't remove all the clips and also removes functions if there are any. I tried to check for funtions with typeof but it returns "string" not "function".What are the memory specifications for Flash MX 2004 Pro? I mean how much memory does flash take for references like C takes 4 bytes for a pointer

View 1 Replies

ActionScript 3.0 :: Enemy Animation Sequence - Rotate + Move, Then Stop Then Shoot Then Rotate Back And Move Off Screen

Aug 10, 2009

I am having some dificulty making a path for this enemy i'm trying to create... cause i want him to rotate + move, then stop, then shoot, then rotate back and move off screen... Its easier if you see it.. you can download the swf file in the zipped archive to demonstrate what i mean. I did it there with tweens. Anyway.. i tried and make it but i'm a little stuck on the stopping part... you can also see what i did in the fla file attatched...

View 1 Replies

ActionScript 2.0 :: Finding Subclips Inside A Movieclip

Sep 30, 2009

Is it possible to get a reference to all the movieclips I might have added to a movieclip in the designer. Lets say I want to do this in the onLoad function of the movieclip. I couldn't find a way to do it.

View 3 Replies

ActionScript 2.0 :: [MX04] Remove Subclips Of Clip

Mar 11, 2004

I have a movieClip on stage _root.myClip. I have attached several clips to this clip. Now after some random amount of time I need to remove all these clips. One catch though I can't remove the original clip and I dunno if its a good practice to store movieClip references in arrays for later retrieval cause there are gonna be around 1000+ subclips at any given point of time. (This is the logic so I cant change that)

I have also tried for-in loop but it doesnt work for me. I doesn't remove all the clips and also removes functions if there are any. I tried to check for funtions with typeof but it returns "string" not "function".

What are the memory specifications for Flash MX 2004 Pro? I mean how much memory does flash take for references like C takes 4 bytes for a pointer

View 1 Replies

(cs5) Making A Rollover Animation?

Oct 19, 2010

im making a button and on the rollover animation I want to have it splatter paint, only thing is I dont know how to get an image into flash that doesnt look crappy. I know that I need a vector image, but im not familiar with vectors as I usually use photoshop. I tried using a photoshop brush image, a simple paint splatter in which I was just going to tween to a larger splatter but like I said the image looks blurred because itsa bitmap.

another newbie question, but when you make an animated button, is the background included in the animation? Like lets say I import a button, give it an animation to glow on rollover or something, if i went to use that .swf would the background that it was placed on show? or would it just be the animation that shows on the default web browser background.

View 3 Replies

ActionScript 3.0 :: Making .mp4 And What To Use For 3D Animation

Jun 22, 2009

I have to load several images and then do 3D image animation. For this if I use Flash CS4 platform,do I have to use Papervision 3D or other 3D open source classes. Further,I have to create a movie file which contains all the image animation and allow user to view it. It is similar to [URL] website concept. So,is it possible to make .mp4 files with actionscript or I have to rely on AIR platform.

View 3 Replies

Making Button To Start Animation

Nov 15, 2009

I'm very new at Flash and while Ive picked up the basics of tweening and creating animations. I'm trying to create an image of a post it note that is revelaed via a mask when a user rolls over a seperate image. I have created the animation of the mask and it revelas the note fine. My question is how do I create an invisible button and code it in action script so when I roll over image 1 my mask tween begins playing to reveal the post it.

View 2 Replies

Actionscript 3 :: Making An Animation In Flash Cs4?

Jun 28, 2011

I was making an animation in flash cs4 and i was making a play/pause button. Everything pauses when clicked but the play button gives me an issue. I have some movie clips with animations in them so when i tell them to play, instead of resuming where they were, they play regardless of whether or not they should be playing.

View 3 Replies

ActionScript 2.0 :: Making An Animation Play Only 2x?

Sep 5, 2009

I have a movie which repeatedly plays. I need to make it stop after the it plays 2x.Here's the code

Code:
onClipEvent (load) {
function loadit(targ) {

[code]........

View 7 Replies

Flash :: Images Vibrate So Much Making The Animation To Look Bad?

Jul 28, 2009

I am doing an animation for a web site with Flash CS3. I need to make images (.jpg) that I converted in graphic symbols, to pass along the screen continuously. I know, for many of you this must be very basic question, but I don't know how to solve it. My problem is that the images vibrate so much making the animation to look bad.

View 3 Replies

Professional :: Making An Animation With Transparent Background?

Sep 29, 2010

I want to make my animation have a transparent background instead of a blank background so that it can blend with my presentation. Is it possible to create the movie like this?

View 7 Replies

ActionScript 2.0 :: Making An Image Transition Animation?

Jan 29, 2009

I am not new to flash. I am making an image transition animation. But when i move an image from one point to another point that in x or y position it gets shaky and image animation is not smooth at all. I am just trapped that what do? i have tried the image in different qualities and resolutions but dont know how to do it.

I am attaching the shaky.zip file. Im using motion tween to animate the image.

View 4 Replies

ActionScript 2.0 :: Making Animation Of Someone Breathing With Multiple Layers

Mar 23, 2009

I'm basically making a animation of someone breathing, with multiple layers. What I want to happen when a user clicks the animation is for it to switch to the next layer seamlessly (skin>muscles>skeleton). Each layer has the same 60 frames. For example, if the skin layer's currentframe was '37' i'd want the muscle layer to start at '38' when clicked.Below is some of the code I already have. I can trace the currentframe of the original mc, however the attached movieclip refuses to gotoAndPlay to that number?[code]

View 1 Replies

Professional :: Making A 1940's Style Animation With Flash

Apr 19, 2011

I would love to create a 40's style animation, but i need to know what to set the frame rate to and other stuff.

View 1 Replies

ActionScript 3.0 :: Making An Animation That Tweens Two Different Objects At Different Speeds?

Feb 4, 2009

I am making an animation that tweens two different objects at different speeds dependent on the position of the mouse. This is working fine, however, when the user takes the cursor outside the flash box and enters the frame it jumps to that position.

I have created a tween for this first instance however, if the user continues to move there cursor before this tween has finished it continues to jump.

Here is the code I have written

Code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, CheckDirection);
import fl.transitions.Tween;
import fl.transitions.easing.*;

[Code]....

View 1 Replies

IDE :: Making Animation Where Text Appears Via Masked Layer?

Apr 18, 2009

This is something I tried to do once long ago with Flash MX, and it did not work for me, and now with CS3, I find that the same concept is not working. What I am trying to do is make an animation where the text appears via a masked layer, but I would like the mask's gradient to be revealed in the animation. Here is what I have: And here is how it is being displayed during the animation:

View 8 Replies

ActionScript 2.0 :: Making Animation Play Then Load Movie

Aug 31, 2003

i have three buttons. each time i press one of them i tell them to play the same mc. at the end of that mc i want to (depending on which button has been hit) load either movie 1, 2 or 3, corresponding to button 1, 2 and 3.

View 3 Replies

Flash :: Professional - Making An Animation For The Box Which Starts From A Sheet Of Paper And Folds Into A Box

Feb 25, 2012

I installed Adobe Flash CS5.5 a couple of days back...Trying to learn a few basic tricks such as motion tween (messed up things with the bone tool though)..Well the problem is, a friend of mine made a 3D drawing in Solid Works(a modelling software). It is a sort of box, now he wants me to make a flash animation for the box which starts from a sheet of paper and folds into a box and then the camera zooms out.

Now i have no idea how to do that..jpg file can be made and imported to flash...but as it will be an imported file how can it be manipulated to achieve the final task....taking screen shots of the box at various stages of solid works can be done and then played all together in flash baut it would be very tiresome and time consuming...
I dont want anyone to make it for me just guide me what tools and tutorials to look at.

View 4 Replies

ActionScript 1/2 :: Holding Down A Key: Execute ONCE?

Mar 28, 2011

scripting for holding a button down and having the action take place once.So thing is, I have code for pressing a button (which is the up arrow button)This was suppose to show the animation for someone shooting constantly until released:
 
if (Key.isDown(Key.UP)){        fox.gotoAndPlay(16);        deploy.gotoAndPlay(2);        trace("Pressed.");    }
 
Unfortunetly the results are:Holding down the up key places out "Pressed." constantly instead of once.fox.gotoAndPlay(16) stays on 16 rather progressing the animation (to which should come back to 16 at a repeated process)deploy.gotoAndPlay(2) plays a sound but before: the sound played constanlty rather once) recently: sound never playsI also need code that prevents the player from moving when holding down the up arrow key.So in total, I want the player to be able to hold the up key, and everything executed is played once until pressed agan after release.I heard about adding listeners:
 
var myListener:Object = new Object(); myListener.onKeyDown = function() {     KEY = Key.getCode();     if (!this[KEY]) {         trace("You pressed "+KEY);     }     this[KEY] = true; }; myListener.onKeyUp = function() {     KEY = Key.getCode();     trace("You released a key."+KEY);     this[KEY] = false; }; Key.addListener(myListener);
 
but I can't understand this technobabble and everytime I try to work it, it only puts error outputs.

View 7 Replies

Php :: Holding The Session In Flex?

Jun 23, 2009

I am getting the session generated in Flex Application in a hidden text field, but when i refresh the page it gets back me to login page...

How can i hold the session of the page until the browser is not closed...

I am getting the session value from PHP.

View 2 Replies

ActionScript 3.0 :: Pressing A Key Vs. Holding A Key Down?

Jan 15, 2010

How can I differentiate between these two actions in AS3? I'm working on a side-scroller,and I want to require the "attack" button to be pressed for each successive attackCurrently you can continuously attack by holding down the attack key. I'm using a standard event listener, i.e.

ActionScript Code:
private function keyDownFunc(event:KeyboardEvent)
{

[code]....

View 1 Replies







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