Multiple Enemies?

Simple question on performance
I have lots of enemies being created and put in a array, Around 30 enemies in total
The enemies use pythagoras to work out there distance to the player the use cos() to move to the player
DistanceX = this.x - Main.Pl.x;
DistanceY = this.y - Main.Pl.y;
this.x -= Math.cos(Math.atan2(DistanceY,DistanceX)) * ZombieSpeed;
When there are multiple enemies the scene starts to lag really bad and Im sure its because of so much pythagoras
Any ideas on how to improve Performance?

most likely the problem is not the number of calculations but a display issue with so many enemies on stage.
if those enemies do NOT change frame (ie, they are one frame movieclips), enable their cacheAsBitmap property:
this.cacheAsBitmap=true;

Similar Messages

  • Multiple instances of objects

    Ok, so I am making an RPG kind of like Dungeons and Dragons. Unfortuantely with that comes the need for multiple, different objects of the same class: Monster
    import java.util.*;
    public class BattleCall
         public static void main(String[] args)
              State h = new State();
              final Monster Goblin = new Monster(12,10,12,1,8,-1,13,1,8,2,"Goblin");
              final Monster Pirate = new Monster(14,10,14,2,9,-1,12,1,10,4,"Pirate");
              h.h(Goblin,Pirate);
              This calls two instances of the monster class. Because of sheer frustration I have gotten rid of the whole battle scheme for now. All I am trying to do right, through the State class is show the AC's of the two monsters (the first parameter)
    Here is my monster class
    //Beginning stuff here, too lazy to retype, no method
    int AC;
    //All other variables here, AC is the first one
    Monster(int AC1)//All other variables also in here, program on laptop not desktop, too lazy to retype
    AC = AC1;
    }Mind my laziness, it's late and I'm just about to go to bed.
    Anyways, through the tow instances I need to keep the variables seperate, here is the code for the State class
    //beginning stuff here
    public void h(Monster mon1,Monster mon2)
    System.out.println(mon1.AC+","+mon2.AC);
    //end stuffOk so you have all my code, now for the output...... 14,14 it should be 12,14 (12 being goblin, 14 being pirate) If I run my battle with two enemies, it places the pirate in twice, it's name, intelligence, strength, everything instead of pirate once goblin once..... I have tried using arrays to achieve this but to no avail... If this is possible PLEASE help me out.

    ok, and can you please tell me how it doesn't follow those guidelines? If he where to make it shorter then it wouldn't be self contained. He showed us just the methods that where causing the problem. How would you present the problem "Hlpes prgrm no wrk!!!!!" and leave it at that? I'll just point this out before you say anything else:
    U nEd 2 b clearer bout wot d prob iz!_
    Fact is your not helping him at all.
    Now on to his question. I have run code similar to yours in my own sessions and everything turns works out fine.
    public class Monster{
         public int AC;
         public Monster(int a){
              AC = a;
    public class State{
         public State(){}
         public void h(Monster mon1, Monster mon2){
              System.out.println(mon1.AC+","+mon2.AC);
    public class Test{
         public static void main(String[] args){
              State h = new State();
              final Monster Goblin = new Monster(12);
              final Monster Pirate = new Monster(14);
              h.h(Goblin, Pirate);
    }That outputs "12,14". So the problem most be somewhere else in the code.

  • Re-using Animation on Multiple Characters

    Hi I don't know if this is the right place to ask this, please bear with me. So in my game, I got 20 enemies that looked different, but should have the same animations. For example the dying, running, walking animations are all structured the same. But I don't want to do this manually, giving the fact that I'm using frame by frame animations, it will consume a lot of my time. Is there a way I can re-use my main animations to other movieclips/characters? Like reusing armature/animation via bone tool... thanks
    There's an old thread almost the same as mine. Saw this link, and this is the one I'm talking about. But sadly, ain't free.
    http://www.cartoonsolutions.com/store/catalog/Re-using-Animation-on-Multiple-Characters-Vi deo-Tutorial-p-16569.html

    Yes, I'm currently using FbF. But I can't show you any SS right now for the 20 enemies, cause I ain't done with that part. I only got my player's (main character) animations. Here's some of it:
    this is not drawn FbF, rather they are vector parts rotated/tweened each frame.

  • Multiple sounds

    Hi,
    Does anyone know what the maximum number of sounds that can
    be played simultaneously in Flash CS3 is? I am trying to make a
    mixer for more than 8 sounds, is this possible?
    Thanks!

    There are 8 sound channels. Only the first two can be
    manipulated via
    the score. The others can only be controlled via lingo
    commands. Check
    the help documents.
    OleKristianHH wrote:
    > Hallo,
    >
    > How do you deal with multiple sounds in Director as
    there is only two sound
    > channels?
    >
    > Im working on a small game, and I need sounds for the
    player, the world,
    > enemies and so on.
    > What is the best way to solve this?
    >
    > Thanks
    >

  • Multiple sounds, Multiple Frustrations

    Hey all,
    I haven't gotten any responses to my previous sound
    questions, but I assume that is because the answer is obvious and I
    should know better. However, I am still struggling. I have a few
    basic questions that make up my lack of understanding of sound in
    flash. An example is... I have a narrator reading off questions of
    a quiz. The first time I create the sound object "narrationSound",
    I have him read an intro. Next, it needs to move on to the first
    question, etc. I try to detect when the sound ends by using
    onSoundComplete, which works once it seems. I do use the same sound
    ID for the next sound, so perhaps I am not deleting the first one
    properly. I don't want to create a new sound ID for every sound,
    because the sounds are played on the fly, and could come up in any
    order. It would be hard to keep checking for the end of every
    sound, even if only one of 50 were playing. I pasted some code in
    an earlier post, but have since been changing mine to try different
    stuff. I think there is an overall understanding of how sound works
    that I just don't have. I come from Director where you can assign
    sounds to a sound channel, and when you replace the sound in the
    channel with a new one, the old one stops and new one starts. So
    you could control narration by just dealing with one sound channel.
    I would like to try to do this on some level with the sound ID. Any
    thoughts?

    There are 8 sound channels. Only the first two can be
    manipulated via
    the score. The others can only be controlled via lingo
    commands. Check
    the help documents.
    OleKristianHH wrote:
    > Hallo,
    >
    > How do you deal with multiple sounds in Director as
    there is only two sound
    > channels?
    >
    > Im working on a small game, and I need sounds for the
    player, the world,
    > enemies and so on.
    > What is the best way to solve this?
    >
    > Thanks
    >

  • How do multiple family members use iTunes.? One account or multiple?

    How do multiple family members use iTunes. One account right now but apps gets added to all devices and iTunes messages go to all devices.  Can multiple accounts be setup and still have ability to share purchased items?

    Hey Ajtt!
    I have an article for you that can help inform you about using Apple IDs in a variety of ways:
    Using your Apple ID for Apple services
    http://support.apple.com/kb/ht4895
    Using one Apple ID for iCloud and a different Apple ID for Store Purchases
    You can use different Apple IDs for iCloud and Store purchases and still get all of the benefits of iCloud. Just follow these steps:
    iPhone, iPad, or iPod touch:
    When you first set up your device with iOS 5 or later, enter the Apple ID you want to use with iCloud. If you skipped the setup assistant, sign in to Settings > iCloud and enter the Apple ID you’d like to use with iCloud.
    In Settings > iTunes and App Stores, sign in with the Apple ID you want to use for Store purchases (including iTunes in the Cloud and iTunes Match). You may need to sign out first to change the Apple ID.
    Mac:
    Enter the Apple ID you want to use for iCloud in Apple () menu > System Preferences > iCloud.
    Enter the Apple ID you want to use for Store purchases (including iTunes in the Cloud and iTunes Match) in Store > Sign In. In iTunes 11, you can also click iTunes Store > Quick Links: Account.
    PC (Windows 8):
    Enter the Apple ID you want to use for iCloud in the Control Panel. To access the iCloud Control Panel, move the pointer to the upper-right corner of the screen to show the Charms bar, click the Search charm, and then click the iCloud Control Panel on the left.
    Enter the Apple ID you want to use for Store purchases (including iTunes in the Cloud and iTunes Match) in iTunes. In iTunes 10, select Store > Sign In. In iTunes 11, click iTunes Store > Quick Links: Account.
    PC (Windows 7 and Vista):
    Enter the Apple ID you want to use for iCloud in Control Panel > Network and Internet > iCloud.
    Enter the Apple ID you want to use for Store purchases (including iTunes in the Cloud and iTunes Match) in iTunes 10 in Store > Sign In. In iTunes 11, click iTunes Store > Quick Links: Account.
    Note: Once a device or computer is associated with your Apple ID for your iTunes Store account, you cannot associate that device or computer with another Apple ID for 90 days. Learn more about associating a device or computer to your Apple ID.
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • How do I move multiple dimension members up one level in planning?

    I can't figure out how to select multiple members.
    I hope I don't have to cut and paste them individually.

    ODI maybe ?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How can I setup a mail-specific passcode/restriction on iPad used by multiple family members?

    How can I setup a mail-specific passcode/restriction on iPad used by multiple family members?
    Have an Exchange mail account setup and accessible in my mail on iPad... however my kids use it and i would like to restrict them from accessing this specific portion of the device.  I tried viewing restriction options and do not see that i can apply a restriction specifically to Mail.  Thanks for your help.

    Not a feature of iOS. Check the AppStore to see if there are other
    mail apps that allow passcode protection.
    Or use Safari to log onto your email via a web-based interface and
    enter your credentials each time. A bit slower, but the kids will
    not know the details to login.

  • How can a family with multiple existing accounts use Home Sharing?

    I'd like to use the new Home Sharing feature, but it appears to be restricted to families in which all of the family members share a single user account.
    We already have separate accounts for each family member. Is there some way for us to use Home Sharing without abandoning most of our existing accounts, along with all of the purchases made by those accounts? I don't think anyone in this situation would be willing to do that.

    Eh. I am not too sure since I have not messed with it much but I do have a great deal of experience with multiple accounts. Each computer can be authorized for multiple accounts. As can iPods. iPods can sync songs/videos/apps from multiple accounts as long as the computer is authorized with them. What I have set up here, is I buy my stuff I want, my parents buy what they want and so do my brothers. When my bro gets something I want I just move it to my computer. That way all our accounts are separate, but if there is something I want I can get it. Also, since the music no longer has DRM, it won't matter. It will play on any computer. What you should see is if you can just do the shared library with multiple accounts. Then if you don't have videos or such, you can get apps or music. Hope this helps!

  • How can multiple users use the same Creative Cloud Individual on one single-machine?

    We have one shared graphics workstation, which is infrequently in use by different people - therefore we bought a single-workstation license (which we were referred to "Creative Cloud Individual"). In the FAQs it says it installs locally, but whenever a user different from the installing adminstrator logs in, he is forced to use the trial.
    Is there a way to make the local installation usable on that single machine for multiple users?
    Thanks in advance for your reply

    Serenatasystems do the other users not have administrator access?  What happens if they sign in using the Adobe ID tied to your Creative Cloud subscription?  Do your Adobe Creative applications then exit trial mode?

  • How can I use multiple ipad's on one account without sharing individuals personal email accounts?

    Is it possible to have multiple ipads on one account and share info, but also allow the individual users to have personal email that is not seen on the other ipad's? We have all ipads on same icloud account because we all need to see the same ical. It seems like that's the problem. If it IS related to icloud then if we have separate icloud accounts, how would we share the main ical otherwise? Sharing the ical is very important for this business so everyone can access the daily schedule. Of course each user still wants to have private email.
    Hope this wasn't too confusing!
    Thanks!
    Doreen

    you could set up the main icloud itunes acount for ical and not have in setup on the devices
    and share the calandar with the other itunes accounts on the devices
    or only have it on one device
    devices have the users indervidual itunes icloud setup
    they should be able to access the shared "main" itunes icloud ical account once it's shared
    http://howto.cnet.com/8301-11310_39-57542557-285/three-methods-for-sharing-an-ic loud-calendar/
    if the devices are company owned you could go futher and setup find my iphone on the main itunes account
    and not on the user icloud accounts

  • What happens on iCloud (ex. contacts) when multiple family members use the same Apple ID?

    What happens on iCloud when multiple family members use the same Apple ID?  For example if we all choose to use iCloud for contacts, are they all merged together?  We use the same Apple ID so we can use find my iPhone to keep track of the whole family.

    Of course if you are both connected to the same iCloud account you have the same contacts - what did you expect?. The contacts live on the server and are read from there by the devices; so as you've both managed to sync your contacts up to iCloud they are now inextricably mixed. You can only delete your contacts by deleting individual ones, and doing that will delete them from your phone as well.
    You can only unravel this by
    1. In the iCloud contacts page at http://icloud.com, select all the contacts, click on the cogwheel icon at bottom left and choose 'Export vCard'.
    2. Sign out of System Preferences>iCloud
    3. Create a new Apple ID and open a new iCloud account with it for your own use.
    4. Import the vCard back into the iCloud contacts page.
    5. Go to http://icloud.com and sign in with the original ID. This is now his ID. Work through the contacts individually deleting the ones you don't want him to have. When done sign out and advise him to change his password.
    6. Go to the new iCloud account and delete his contacts individually.
    Of course if you have also been syncing calendars and using the same email address there are problems with doing this.

  • ICloud with multiple family members sharing one iTunes account?

    How will iCloud work for the case where multiple family members share an iTunes account but each has his/her own iPhone/iPad/PC?
    Will iCloud replicate content based on email address, unique Apple ID, iTunes account, or??  If iTunes, we could have trouble as three of us share our iTunes account (started when our daughter was young and continued for simplicity).

    Keep one Apple ID for iTunes purchases (apps, music, etc.) for all family members on the iTunes Store and use different Apple IDs for each iCloud user. That worked for me.

  • HT204053 I have multiple family members using one apple id account and all of each others information is going onto each others phones/how do i stop this?

    I have multiple family members using one apple id and all of our data is going onto each others phones/how do i stop this?

    Each person needs to have their own separate Apple ID along with their own separate computer user account and iTunes Library.

  • Multiple ipods belonging to multiple family members on one computer

    How do I keep my family's libraries separate on one computer. I have been checking and unchecking songs each time I sync one of my children's ipods. It is driving me nuts. There has got to be a better way. My husbands library alone so far is 1300 songs. HELP!

    When the iPods belong to different people, there are basically three ways of using multiple iPods on a computer and these involve:
    a) Sharing a single iTunes library
    b) Creating Multiple Libraries in a single user account
    c) Creating multiple user accounts.
    Note: When you are sharing an iTunes library, you don't have to set each iPod to update in the same manner, you can mix and match from the options below as each iPod has it's own update settings
    Sharing a Library and/or User Account
    If you want to share the one library, you can set either or all of the iPods so that they only get updated with only certain playlists (you can update from more than one if you wish): iPod - Syncing Music
    Choosing the update option "Sync Music - Selected playlists" allows you to create a playlist specifically for the iPod and drag the tracks you want into it. If you tire of the list and want to change it, you just add or remove the songs you don't want. The ones you take out out remain in the library to be used some other time if you choose. You can read more about playlists at these links:
    iTunes: Creating playlists of your favorite songs
    How to create a Smart Playlist with iTunes
    Or you can choose to update any or all of the iPods manually and just drag whatever content you want to them: Managing content manually on iPod and iPhone
    Loading the iPod shuffle differs slightly but it can still be used with the others, for details have a look at this page: Adding songs to iPod shuffle - Windows
    Multiple Libraries
    It's also possible to have multiple libraries in a single account. To create or access a second (or more) library, hold down the Shift key in Windows when launching iTunes 7. In the resulting dialogue you will get the option to create a new library or navigate to the other Library.
    Note: You can only have one Library open at a time and iTunes will default to the last library opened if you don't use the keyboard command to choose one. This can prove tricky when using multiple iPods, if you don't use the keyboard command you can risk syncing to the wrong library: Using multiple iTunes libraries -Windows
    Separate User Accounts
    Another option is to create a separate User account for each person on your PC or Mac. Different accounts by definition would give you completely separate libraries. Each account has it's own iTunes folder, Library and iTunes Music folder and you load it with CDs etc just as you did with your original one. The iPod can be set to update however the owner chooses, sync all, manual or sync specific playlists
    I don't use Windows so I can't give you a step by step on that one, however I can point you to another web page which should help you out. You can read about Windows user accounts here:
    Using Windows XP User Accounts
    Create A New User Account In Vista

Maybe you are looking for