ActionScript 3.0 :: Way Of Removing Enemy Character Permanently
Jul 9, 2011
I am trying to remove an enemy after I kill them and I just started working with code in .as files. The enemy has it's own logic in a .as file and when I use removeChild, the movieclip is removed, but the logic continues to attack the main character (invisible).Is there a better way of removing the enemy character permanently. It kind of scares me that the method I use could just be leaving invisible movieclips on the screen as well.I've tried everything that I have used in previous games: removeChild(EnemyArray[i]);And this, which causes other problems with my code but removes the logic: EnemyArray[i] = null;But these still cause the problem.
View 4 Replies
Similar Posts:
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
Mar 4, 2011
I'm wanting to remove/hide a mc permanently. I though visible = false would hid it but when you go forward a frame and then back a frame the mc is back.
Code:
function pickupKey(evt:MouseEvent):void
{
gotKey = true;
[code]....
View 3 Replies
Oct 25, 2009
I added attack to my character in the game and he attacks and the enemy dissapears, the problem if I can't get my character to die when he touches the enemy. I got it to work once but what happened was that even if I hit the enemy, as soon as I hit it I got to the game over screen and got stuck on a loop between the gameover screen and the moment I defeat the monster.
View 2 Replies
Oct 12, 2008
How would i make an enemy bullet go towards the main character?
View 7 Replies
Jul 21, 2010
I am trying to program a game and I want the enemy character to fire a bullet every second, but instead he is firing an infinite amount of bullets right after the other. Here's the code with the timer:
if (k == 0){
var shootRight1 = new Timer(1000,1);
shootRight1.addEventListener(TimerEvent.TIMER_COMPLETE, enemy1shoot);
shootRight1.start();
[code]....
View 5 Replies
May 8, 2010
Alright, so really I am having 2 difficulties here.
1) When a bullet hits an enemy, if 2 zombies are beside eachother, the bullet hits them both -- How can I make it so the bullet can only hit one?
2) When an enemy has health of 0, it dies, I am trying to get the enemy to be removed from the array that the bullet searches through so it will no longer be affected by the enemy, but it doesnt seem to work, the bullet still hits where the enemy was, as if the enemy is invisible.
[Code]...
View 3 Replies
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
May 13, 2010
I have a textbox and a button in flash. I send data to java server by entering data into the textbox. Firsttime the number of characters i am receiving are correct, from the second time onwards there is an extra character. i.e if i type 1 character it is showing 2.below is the code,
function msgGO() { if (inputMsg.htmlText != "") { mySocket.send(inputMsg.htmlText+"
"); inputMsg.htmlText = ""; }}
[code]....
View 2 Replies
May 14, 2010
I have a textbox and a button in flash. I send data to java server by entering data into the textbox. Firsttime the number of characters i am receiving are correct, from the second time onwards there is an extra character. i.e if i type 1 character it is showing 2. Can someone tell me how do i remove it.below is the code,
function msgGO() {
if (inputMsg.htmlText != "") {
mySocket.send(inputMsg.htmlText+"
[code]....
View 2 Replies
Oct 26, 2009
I'm trying to put the text back into a text field on FOCUS_OUT one character at a time. On FOCUS_IN, I want to remove the text one character at a time.
Here's the basic code:
major.text = "ActionScript 3.0";
major.addEventListener(FocusEvent.FOCUS_IN, inFocus);
major.addEventListener(FocusEvent.FOCUS_OUT, outFocus);
function inFocus(event:FocusEvent):void {
major.text="";// want to clear the text one character at a time
} function outFocus(event:FocusEvent):void {
major.text="ActionScript 3.0"; // want to put the text back in one character at a time
}
I attached a fla. that does this in ActionScript 2.0, but I'm trying to do this in ActionScript 3.0.
View 6 Replies
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
Mar 21, 2012
im using stopAllSounds();command to mute all sounds, and it works fine with sounds that are already loaded (background music), but if there is button which triggers some new sound (after activating mute button ) or any other function to import new sound object you still can hear it despite stopAllSounds();.which command to use to permanently block all sounds already loaded and those which can be triggered by future actions.Now i have stupid situation> background music is muted but you can still hear sounds when cliclking buttons (which is ok but NOT in muted stage).
View 5 Replies
Mar 30, 2010
I have a main swf which has sound on/off buttons. It has many SWF's which are loaded into different placeholders at different time. All of them have different sounds in them. In addition to that there is a music loop going on in the background.Now, this perticular swf lets call it Father will be placed in some swf later on. What I'm trying to do right now is when the sound off button is pressed turn off all the sounds permanently so the child swf's and their sounds stop too.I have found a way in AS2 :
global = new Sound( ) //no movie clip target path.
and add the following code to your off button.
on(release){
global.setVolume(0); //mutes all sound
}[code]....
which ofcourse does not work for AS3. So how can I stop all sounds permanently in AS3? Secondly what if I have one sound (my background loop) which I want to keep going on.
View 2 Replies
Jan 13, 2012
I'm working on a project that has multiple 'scenes' located on each frame. In one scene, if you click on an object it disappears. I did this using the visible = false method. However, anytime you return the scene after, the object is visible again. How would I write the code so that it stays invisible permanently when you click it, regardless of whether or not you leave and later return to the scene?
[Code].....
View 1 Replies
Jan 20, 2009
I'm trying to make a game, but I'm stuck on a few conceptual parts that I'm not sure how to handle.
I want to create an object that changes its picture when I click on it. My idea was to have a creature that once you click on, changes to a different state. For example, you have a picture of a balloon and when you click on it, it plays the animation of it popping.
I have no idea how to do that, I've looked at buttons but it doesn't seem to persist in the state once you click on it. (or maybe it does and I'm just not doing it correctly?)
View 3 Replies
May 27, 2011
if you can do with the files that were loaded through the Loader class (or another class) remain permanently on the computer of who uploaded the application. That is, even if the person closes the browser or shut down the computer, the files remain on your computer. So when the person is running the same application will not need to wait until the files have been loaded (via download).
The person will enter in the browser page where the application is already included and you can use this application, without waiting any time since the necessary files are not on the computer. If any new files later arose in the application, this would be the only file to be loaded (downloadable) for the computer, which already found the other files that have already been loaded at another time. I can do this in actionscript 3.0? Note: Do not bother with my English because I'm using the google translator.
View 6 Replies
Nov 1, 2009
I have a 'room' movieclip with 4 frames each representing a different view (N,S,W,E). I have a different shape object in each frame. The shape objects all subclass a generic shape class and consequently disappear onClick. The problem is that they reappear when the frame is revisited. I've used event.target.visible = false in the generic shape class. I'm wondering if there is a way to 'permanently' remove them through the generic shape/parent class? I'm trying to avoid a rank of if functions and use a catch-all if possible.
View 6 Replies
Jun 18, 2007
i've created one flash banner with xml driven to pull the image from the folder. the xml file included with the list of the images name and path,then i'm created the banner using the .loadMovie() function. now,the problem is, i need the banner hold the image from the folder even when the source image was removed, so,the banner just need one time to read the image information, without need to read again the xml and doing the loadMovie again while its run for the 2nd time
View 1 Replies
Jan 30, 2012
I'm creating a game with movie clips that are generated using getnexthighestdepth, and have a pause menu too. However, as the movie clips are generated after the pause menu, they appear above it, partially obscuring it. Is there a way to make the pause menu permanently on top?
View 2 Replies
Apr 13, 2010
More specifically is it possible to permanently add strings, for instance, to an array using an input text field and having that text field push the text into the array?
View 1 Replies
Nov 1, 2011
I assume I need to override the mouse over and mouse off event so that they don't do anything and then trigger the mouse over event for each column on the graph.
View 2 Replies
Dec 12, 2010
Right now I have the typical timeline where I have several layers but the problem is all the content doesnot display permanently after its run through the timeline.For example layer 1 will play then disappear and then layer 2 will play through and disappear.
Is there an ActionScript that I can have for example layer 1 play through and display permanently then layer 2 plays and does the same thing, layer 3... so on and so forth one after the other until all the images are shown?I've searched all over but every ActionScript code pauses the entire timeline.
View 4 Replies
Dec 28, 2010
For some reason Adobe doesn't allow us to change the size of the handle in the default slider component. This handle is small and hard to click on quickly. If you try to increase the size of it graphically it just gets resized back down to 13x13 pixels. I've looked into the Slider.as code found in:
Program Files(x86)/Adobe/Adobe Flash CS4/Common/Configuration/Component Source/ActionScript3.0/User Interface/fl/controls/Slider.as
And found that on line 803 there is the code thumb.setSize(13,13). I tried changing that to 60,60 but it doesn't change the size of the handle. I don't know much about classes and I didn't think you had to compile these. I thought that in Flash when you clicked on the Components button that it loaded these classes in at that point but I must be wrong.
ActionScript Code:
override protected function configUI():void {
super.configUI();
thumb = new BaseButton();
thumb.setSize(60, 60);
[Code] .....
View 5 Replies
Feb 22, 2007
Came across yet another obstacle today and was wondering. How would i permanently highlight specific items stored within a list box (flash component) if, say an error occured. Moreover, how would i highlight them red instead of green?
View 1 Replies
Jun 1, 2010
I have a list control and i want the user to be able to select many items at a time. Thus I want it to act that if the control key is pressed while he is clicking. Eg if he clicks on a selected row it should become unselected and if he clicks on a unselected row it should become selected.
View 1 Replies
Sep 24, 2010
I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.
View 4 Replies
Nov 27, 2010
Does anyone know the regular expression to test if a single string character has both upper and lower case character?
eg. All A-Z and a-z.
View 0 Replies
Aug 11, 2009
i was wondering if any of you out there could tell me how it is possible to make a movieclip of a character and when the character is dragged about the screen by the curser, how do you make the characters arms and legs swing about in a realistic fashion.
View 2 Replies
Dec 3, 2009
Im doing a little game with three kinds of enemies. When each enemy blows up I'm trying to put in a different sound. Right now I get sound for my first enemy and none for the other two. The code is the same for all(?). Here's the code:
[Code]...
i have NO idea but will continue 2 scrabble around blindly 'till someone throws me a bone
View 2 Replies