Having trouble with a game

I'm having trouble trying to get the enemy character in a game to attack once and then over again. Right now it's not going through the whole attack animation. If anyone has any ideas that would be great. the site is here:
http://billzgames.comule.com/
and heres the code
//in an enemy attack function-
if (Math.abs(this.x - thePlayerX) < 80 && Math.abs(this.y - thePlayerY) < 20) {
EnemySpeed = 0;
if(Math.round(Math.random()*enemyHitDiff) == 1)
attack = true;
enemyFight();
}else attack = false;
private function enemyFight(){
if ((attack == true)&&(faceLeft == true)) {
animstep += 1;
if (animstep > attackLeftAnimation.length-1) {
animstep = 0;
gotoAndPlay(attackLeftAnimation[(animstep)]);
if(attackLeftAnimation[(animstep)]>14){
attack = false;
}else if ((attack == true)&&(faceRight == true)) {
animstep += 1;
if (animstep > attackRightAnimation.length) {
animstep = 0;
gotoAndPlay(attackRightAnimation[(animstep)]);
if(attackRightAnimation[(animstep)]>14){
attack = false;
Thank you

Having your code all spread out like that makes it difficult to read... But based on what is shown, it almost appears as if you have all of that code nested into a conditional statement.  Is that the case?  I would not nest a function definition in there.
From what I can make out, by itself that code will only execute once, so are you doing anything to make it execute "over again"?

Similar Messages

  • Having trouble with facebook games " zuma blitz" lags, very slow.

    I am having problems with a Facebook game, "Zuma Blitz", the game loads faster, but lags or plays very slow. it freezes with every shot made.. impossible to play. It may be happening with others, but I play this game every day to pass time.

    This is because of the plugin-container.exe.
    if you switch dom.ipc.plugins.enabled to false in about:config
    plugin-container and the problem will dissapear

  • Having trouble with flash games in Google Chrome

    They're running so slooow!  And when I go to a site that has flash anything (a game, even an advertisement) and I'm running iTunes at the same time, iTunes skips. 
    I have a 15" MacBook Pro that I bought in August 2010.  I recently wiped my computer's memory and reinstalled everything because I was having problems with disk permissions.  I'd click "Repair Permissions" in Disk Utility, and it said it would repair all of the permissions, but if I clicked "Repair Permissions" 10 seconds after it was done, the same file errors would show up.  So I completely wiped my computer's memory and reinstalled everything.  I'm completely caught up on updates, and now this flash thing is happening.
    This seems like something that should be a simple fix.  I'm just not sure what that fix is.

    shyarra wrote:
    I have OSX 10.6.8.  I use Google Chrome because it keeps my flash player updated for me. 
    You should still double check to confirm you are using the latest version that is current for your os system (11.1.102.55) - Flash Player Version Check
    iTunes skips.
    Are you using the latest version?
    Disconnect all peripherals from your computer.
    Boot from your install disc & run Repair Disk from the utility menu. To use the Install Mac OS X disc, insert the disc, and restart your computer while holding down the C key as it starts up.
    Select your language.
    Once on the desktop, select Utility in the menu bar.
    Select Disk Utility.
    Select the disk or volume in the list of disks and volumes, and then click First Aid.
    Click Repair Disk.
    Restart your computer when done.
    Repair permissions after you reach the desktop-http://docs.info.apple.com/article.html?artnum=25751 and restart your computer.

  • Having trouble with py-game install MacPosts

    I tried to install py-game using sudo post install py-game but when it tried to make the py-game the failed with exit status 1. The problem was parse errors and other format errors in the include file in /opt/local/include/SDL/SDL_syswm.h. Does anyone know how to get pygame installed? Your help would be greatly appreciated.
    Message was edited by: rmiles

    Having your code all spread out like that makes it difficult to read... But based on what is shown, it almost appears as if you have all of that code nested into a conditional statement.  Is that the case?  I would not nest a function definition in there.
    From what I can make out, by itself that code will only execute once, so are you doing anything to make it execute "over again"?

  • Haveing trouble with my games and i have adobe plash 11

    i dont know if it in my seting or that i have windows xp put cant play my game every since i got the xp

    Quit the game and restart the iPad.
    To quit the game - Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    If that doesn't work try this.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • I'm having trouble with the purchase of currency in the game Castle Clash locks! In order status says "Back" returns so what? Money at stake so I have not returned!

    I'm having trouble with the purchase of currency in the game Casyle Clash locks! In order status says "Back" returns so what? Money at stake so I have not returned!

    You need to contact the developer of the game, or, the iTunes store support.  iTunes store "MIGHT" issue a 1 time refund.  If you want the credits for the game, talk to the game creator.

  • I'm having trouble with the audio on a lot of my games. How can that be fixed?

    I'm having trouble with the audio on a lot of my games. How can that be fixed?

    You need to be more specific. What sort of trouble - no audio, low volume, scratchy sound, etc.?
     Cheers, Tom

  • I am having trouble with my candy crush saga game. It will not allow me to purchase more lives. The finances are fine. What do I do to get it to allow me to purchase more lives?

    I am having trouble with my candy crush saga game. I am not being allowed to purchase more lives, even though the finances are ok.

    Aha! I have sorted it.
    For those with similar problems, the solution is this:
    Macintosh HD > Library > Audio > MIDI Drivers
    Then delete DigiDioMidiDriver.plugin

  • Hi I'm having trouble with your purchase of the game clash of clans

    I'm having trouble with your purchase of the game clash of clans

    Knowing I purchased approximately 4 days before the Master Carr knowing that MasterCard is charged and there is balance I want a solution to my problem

  • Having trouble with iCloud Photo Stream on a Windows Vista 64 machine.

    Having trouble with iCloud Photo Stream on a Windows Vista 64 machine.  Can you tell me why Photo Stream will not stay enabled.  When I reboot, it will disable not to mention that it will not get any pushed photos.  Is there a 64 bit version?

    Hello tw_mama,
    I was looking into the issue you are experiencing and found an article that may shed some light on the subject. It's called iCloud: Account troubleshooting found here: http://support.apple.com/kb/TS3988
    This section in particluar:
    I get an "Unsupported Apple ID" error when I try to sign in to iCloud from my iPhone, iPad or iPod touch.
    Depending on how you created your Apple ID, you may not be able to create an iCloud account with your current Apple ID. If your Apple ID works in the iTunes Store, App Store, Game Center, FaceTime, or with other Apple Services, your Apple ID should work for iCloud. Also, if you created your Apple ID while you applied for a job at jobs.apple.com, your Apple ID should work for iCloud. If you cannot use your Apple ID with any Apple Services, it might not be compatible with iCloud. Contact iCloud Support for assistance.
    All the best,
    Sterling

  • Having trouble with getting on messages and facetime

    having trouble with getting on messages and facetime.  Got two new ipods, one works fine, the other keeps giving us the error: iMessage Activation Could not sign in.  Please check your network connection and try again.  We have tried to reset the factory settings, and verified that the internet is working.  Please help!

    FaceTime, Game Center, Messages: Troubleshooting sign in issues

  • I've been having trouble with in getting iMessage to send messages. I decided to connect to my VPN (along with wifi) and it worked. Why won't it work via my wifi connection alone?

    I've been having trouble with in getting iMessage to send messages. I decided to connect to my VPN (along with wifi) and it worked. Why won't it work via my wifi connection alone?

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • I'm having trouble buying in game . Could not complete the purchase process

    Hello ;
    I have a problem 4 days . I'm having trouble buying in game . Error : Could not complete the purchase process . my credit card no problem and with another card and I've tried yet another mail adress . and itunes correction problem . This problem came later.
    Waiting for solution help

    Hi jonijo,
    You probably also got a message to contact iTunes Support, which is what you need to do:
    https://expresslane.apple.com/Issues.action
    Select the options that best apply to your situation. You will also have an opportunity to fill out a description of your problem. iTunes Support will contact your via email, usually within 24 hours.
    Cheers,
    GB

  • TS1702 Hi there! Am I alone having troubles with kids' app Little Pets Shop? Crazy invoices with €89,99 the "Wonderful Mountain"!! Has anybody got an idea? Thanks a lot

    Hi there! Am I alone having troubles with kids' app Little Pets Shop? Crazy invoices with €89,99 the "Wonderful Mountain"!! Has anybody got an idea? Thanks a lot

    One of your kids made an in app purchase that you did not know about. Some apps include in app purchase and games do this quite often. The game itself is free, but you might have to purchase additional items to enhance the game or to unlock certain levels.
    You can prevent this from happening in  Settings>General>Restrictions>In App Purchases>Off.

  • Hi, i am having trouble with my mac mail account, i cannot send or receive any emails because of the server connection problems. Message says it could not be connected to SMTP server. Thanks in advance for your help.

    Hi, i am having trouble with my mac mail account, i cannot send or receive any emails because of the server connection problems. Message says it could not be connected to SMTP server. Thanks in advance for your help.

    Hello Sue,
    I have an iPad 3, iPad Mini and iPhone 5S and they are all sluggish on capitalisation using shift keys. I hope that Apple will solve the problem because it is driving me crazy.
    I find using a Microsoft Surface and Windows 8 phone, which I also have, work as well as all the ios devices before the ios 7 upgrade.
    It has something to do with the length of time that you need to hold the shift key down. The shift key needs to be held longer than the letter key for the capitalisation to work. For some reason, this is a major change in the way we have learnt to touch type on computers. I am having to relearn how to type!
    Michael

Maybe you are looking for