Trying to get ricochet mechanics to work, need help!

Hey, for a project I'm doing, I'm making a ricochet game with Actionscript 2.0, where the player shoots a bullet and it bounces off objects trying to hit the opponent. It's working decently so far, but my problem is I'm having a VERY hard time getting it to work right.  Sometimes when I shoot at a box, the bullet will tunnel through it, bouncing off of invisible walls on its way. I just want the bullet to bounce off of the edge all around, but it is tunneling as I'll show you in a video I uploaded. Here's the code I'm using currently, but it's having this tunneling problem.
if (bullet_fired.hitTest(boxobject)) {
                if (bullet_fired._y<=184 || +bullet_fired._y>=214) {
                    bullet_fired.diry *= -1;
                    bounces += 1;
                }else {
                    bullet_fired.dirx *= -1;
                    bounces += 1;
where 184 is the top of the box and 214 is the bottom.
Am i approaching this completely wrong or what am i doing wrong.
Here's the video I uploaded of me demonstrating my problem. http://www.youtube.com/watch?v=O9dwW4_UcFM
Please help me and give any suggestions you have, I'm pulling my hair out!!

you're repeatedly satisfying both your hittest and your y constraints when the bullet is shot at a shallow angle.  ie, the y-property of your bullet does not change enough with the initial hit to prevent a 2nd, 3rd etc hit.
again, to remedy, use:
if (bullet_fired.hitTest(boxobject)) {
                if (bullet_fired._y<=184 || +bullet_fired._y>=214) {
                    bullet_fired.diry *= -1;
bullet_fired._x=previousX;  // you need to define previousX and previousY
bullet_fired._y=previousY;
                    bounces += 1;
                }else {
                    bullet_fired.dirx *= -1;
                    bounces += 1;

Similar Messages

  • I have an ipod touch 2nd generation, i'm trying to get apps that will work and i cant find any. Its says i need an update because it has ios 3.1.3 , but on itunes it says there is no update ? what apps can i get??

    i have an ipod touch 2nd generation, i'm trying to get apps that will work and i cant find any. Its says i need an update because it has ios 3.1.3 , but on itunes it says there is no update ? what apps can i get??

    Sounds like you actually have a 1st generation as those cannot update beyond iOS 3.1.3.
    Model Identifier Utility
    rachelfromnorthumberland wrote:
    what apps can i get??
    Finding iOS Apps Compatible with Older Devices

  • I am using an I phone 5 in Germany and trying to get text messaging to work through the hands free Bluetooth connection on a Honda CRV. It keeps telling me that text messaging is not a feature of my phone. messages come in on the phone.How to resolve ?

    I am using an I phone 5 in Germany and trying to get text messaging to work through the hands free Bluetooth connection on a Honda CRV. It keeps telling me that text messaging is not a feature of my phone. messages come in on the phone.How to resolve ?

    mono 8 bit 8k is 64kbps, yes. 8 bits times 8,000 = 64,000 = 64k bits/sec.
    And yes I think that's a typo - there's no such thing as 'Mone' that I've ever heard of...
    But you might want to check to find out if this is a mu-law non-linear format, possibly - there are several ways that 8 bit 8k wav files can be encoded, and typically phone systems don't use linear ones. If you have a log-in to Zultys' user-base system they have an FAQ there, I believe - the answer might be in that, and it won't cost $500.

  • I am trying to get my printer to work.

    I am trying to get my printer to work. It is a Canon MP240, it does not show up in the printers menu. Though it is plugged in via USB.

    This printer does have a driver available via Software Update, meaning that when you connect the printer to the Mac via USB cable the driver should be downloaded and installed automatically for you. Of course this will not occur if the Mac cannot detect the printer at the end of the cable. So if you open Print & Scan, select to Add and the MP240 is not shown in the Default Add Printer view then there could be a problem with the USB cable or with the printer.
    To double-check if the printer can be seen by the Mac, open System Information and under the Hardware entry in the sidebar, select USB. Then in the top right pane you will see all the USB connections on your Mac and what is currently connected to them. If the MP240 is not shown, then try moving the cable to a different USB port on the Mac. And don't use a USB hub or the USB port on the keyboard. If moving doesn't help the printer appear under one of the USB busses, then try a different USB cable. If that still doesn't help, turn off the power to the printer and unplug the power cord for 10 minutes before reconnecting and turning it back on.

  • My Pro Tools program was damaged by the Creative Cloud system. I was invited to install and try the Cloud,but it did me a great dis-service and has set me back in Production and personal time trying to get my pro Tools working again. I am really disappoin

    My Pro Tools program was damaged by the Creative Cloud system.
    I was invited to install and try the Cloud,but it did me a great dis-service and has set me back in Production and personal time trying to get my pro Tools working again. I am really disappointed and would like you to advise me how to restore my program to its working state. I am in a traumatic state since I have Artistes life work being processed in the Pro Tools 9 Program. Help! Help! Please.Ps. I tried reinstalling the software from the Disc....Still NOT working.

    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • Im trying to get my imessage to work on my iphone4

    im trying to get my imessege to work on my iphone4,i set up the account and did everything by the book .
    the imessege works fine on my macbook but dont seem to work on my iphone .
    i allways had this probleme on my iphone but recently i upgraded my ios to ios 7 and it didnt made any diference .
    please help....

    This may be of use,
    http://support.apple.com/kb/HT4527

  • Hello i just got a MacBook Pro and a website i am trying to get on is saying i need to allow pop-up blockers but i don't know how to do so can anyone help?

    hello i just got a MacBook Pro and a website i am trying to get on is saying i need to allow pop-up blockers but i don't know how to do so can anyone help?

    Go to your browser preferences and select the appropriate setting.  This is for Safari:
    Ciao.

  • IPod doesn't work need help

    I have been trying to get my ipod to work by following the online troubleshooting guide but it doesn't help.
    my ipod doesn't start properly it shows that file icon wioth the caution symbol, and sometimes shows a battery icon with that same symbol, when it connects it stays connected for a few secondsthen it restarts a there is a clicking sound coming from the ipod.
    please help

    Hello,
    If you are getting the "sad iPod" and the iPod's hard drive clicking, these are both indicators that your iPod's hard drive is probably out of place. Before you go to Apple about this, try this and see if it solves the problem for you:
    To get your iPod's hard drive back into its correct place, use you hand to tap it firmly on both sides several times, or until if you hear the hard drive stop the clicking.
    This isn't a joke, because an Apple employee instructed someone to do this, and it has worked for many people ever since!
    Also, have you seen these two helpful links yet?
    iPod displays a folder icon with an exclamation point
    Exclamation point and folder (post)
    I hope this helps! Post back it your problem is solved or not..
    ~~Kylene

  • I can't get the product i bought need help NOW doesn't let me connect when i have good internet

    i can't get the product i bought need help NOW doesn't let me connect when i have good internet

    [personal information should not be posted - https://forums.adobe.com/docs/DOC-3731]
    [This is an open forum, not Adobe support, please do not post personal information]
    https://www.adobe.com/account.html to check your subscriptions
    Cloud programs do not use serial numbers... you log in to your paid Cloud account to download & install & activate... you MAY need to log out of the Cloud and restart your computer and log back in to the Cloud for things to work
    Some general information for a Cloud subscription
    Log out of your Cloud account... Restart your computer... Log in to your paid Cloud account
    -Sign in help http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

  • Can't activate iPad after getting it from repair. Need help quick!

    I recently broke the screen of my iPad but the hardware was working very well. Today I got it back from the repair service I gave it to (not Apple store), and when I turn on the iPad, it tells me to activate the iPad using my Apple ID, I enter all my info correctly, but it doesn't unlock. Did they give me a wrong iPad, did I get scammed? Please I need help quickly since I will be leaving the town after 3 days. Thanks for any help

    Do you have the serial number of the iPad you purchased & sent in for repair? If so, look on the back/bottom of the iPad to see the serial number of the iPad you have. Does it match?
     Cheers, Tom

  • Pleeeeeaaaaaaaaae help new ipod won't work need help

    So I'm a total technophobe so please any help write it for idiots so i can follow it lol.
    So I get my new ipod this morning and very happy I am until I plug into into my computer. My computer recognises it as an ipod but then comes up with the message error during installation, then it says the data is invalid. it does this if I plug the ipod in or if i use the new hardware wizard. So far I have tried unistalling itunes, re installing windows xp. When I try to remove the device from device manager it will not remove from the list.Ive tried it in different usb ports, I've tried system restore and nothing is working pleasssssssssssseeeeeeee help ive been at it for 7 hours now and i feel like crying
    Ive been trying

    in the device manager it has a yellow question mark and according to the error code this is because the device is incorrectly configured i have no clue how to fix this
    I am reluctant to uninstall usb drivers as I have discovered today the system disc for my computer is broken so i wont be able to to reinstall major components of puter.
    thank you for any help u can give

  • My ipad 2 suddenly shut off and asked me to connect to itunes it asks me to restore but it wont work need help pls

    my ipad 2 suddenly shut off and asked me to connect to itunes it asks me to restore but it wont work need help pls

    The iPad is telling you it has entered the recovery mode - you need to follow the instructions in http://support.apple.com/kb/HT1212 for connecting to a computer running iTunes by way of the recovery mode.

  • I have a mac osX 10.5.8 and i could always make photo books with iphoto , now all of a sudden i cant because i have iphoto version 7.1.5 i have tried countless updates and nothing is working ? help ?

    i have a mac osX 10.5.8 and i could always make photo books with iphoto , now all of a sudden i cant because i have iphoto version 7.1.5 i have tried countless updates and nothing is working ? help ?

    Books are no longer supported with iPhoto '08 (a roughly six yeal old product) - you can purchase an iLife '09 DVD from someplace like Amazon or eBay and install it - iPhoto '09 is still supported this year
    LN

  • IPhoto got videos my phone doesn't and that i need. when i synchronize my photos including videos they are still not getting on my phone. i need help...

    iPhoto got videos my phone doesn't and that i need. when i synchronize my photos including videos they are still not getting on my phone. i need help...

    You aren't running iOS if you are using iPhoto, or a Classic operating system.  Go to Apple menu -> About This Mac and find out what you really are running, and then use this link to post in the right place:
    http://discussions.apple.com/docs/DOC-2463

  • HT1911 I have reset my Apple ID & Password but I still cannot access the music I purchased using another computer, ID & PW. It keeps saying that my computer is not authorize to play the songs. I have tried everything and nothing seems to work. Help!

    I have reset my Apple ID & Password but I still cannot access the music I purchased using another computer, ID & PW. It keeps saying that my computer is not authorize to play the songs. I have tried everything and nothing seems to work. Help!

    iPod touches or any iDevices from Apple sync only to one computer. If you sync to a different computer, all your music will be replace with the music from the new computer's iTunes. If the music were purchased from iTunes, you can re-download them again otherwise the music on iPod touch will be deleted. Do you have iTunes backup? 

Maybe you are looking for

  • Western Digital External Drive and a VERY slow computer. Is my HD failing?

    Hello, thank you for looking at my question. First off, I am NOT very tech-savvy, but I'm willing to research and learn, I'm just afraid to make a mistake and blow up my computer. I have had my Macbook for 2 years. I have not backed up my hard drive

  • Date Format in 'HH:MI' - help needed

    I have a table details that contains time_status column of Timestamp datatype. Data is stored in the column in the format '1/1/2008 10:31:00.000000 AM'. Now I want to select the data in HH:MI fopmat only. i.e., for '1/1/2008 10:31:00.000000 AM' I sho

  • Package javax.xml.parsers does not exist

    When I compile the sample program for xml, DOMEcho.java, or any other xml java program, I get errors on the import statements. For all the import statements within java.xml.* I get an error message such as: package javax.xml.parsers does not exist. I

  • Dense_Rank() over order by date fields not working properly

    Hi, i have a pl/sql statement which looks like this: WITH OrderedByDateTable     AS      SELECT     gsp.*, DENSE_RANK () OVER (ORDER BY A_varChar_col1, decode(upper('COMPLIANCETICKSDATE'),'TASKNBR',TASK_NBR, 'DESCRIPTION', DESCRIPTION, 'PARTNBR', PAR

  • Pulling "cn=Users" account data from Active Directory issue

    I'm using the following general syntax: ldapsearch -h <active directory server> -p 389 -D "CN=Administrator,CN=Users,dc=ORACLE,dc=COM" -b "DC=ORACLE,DC=COM" -s base objectclass=* What I get is only "cn=System" output. Any ideas to get the "cn=Users"