Collision detection issues - help please?

Hi guys,
I'm currently developing my own shoot em'up game where I'm having  problems setting up the collision detention for bullets hitting/damaging  the enemy, I'm not sure why it isn't working. I'm got four classes for  this game so far which communicate to each other;
Player class - movement and  bullet control/action for player
MainShapeShooter class - enemy behaviour and game logic
Bullet class - Bullet properies
Collision class - Collision between player and enemies
Note: player and enemy have collision boxes, but when the player  fires bullets, bullets go through the enemy, enemy isn't detenting the  bullets.
Player class
Code:
private function shootBullet():void
               //Bullet's velocity
               var bullet_Vx:Number=Math.cos(_angle) * -10;
               var bullet_Vy:Number=Math.sin(_angle) * -10;
               //Bullet's start position
               var radius:int =- 50;
               var bullet_StartX:Number = x + radius * Math.cos(_angle);
               var bullet_StartY:Number = y + radius * Math.sin(_angle);
               //Create bullet instance and add it to the stage
               var bullet:Bullet = new Bullet(bullet_Vx, bullet_Vy, bullet_StartX, bullet_StartY, "square");
               parent.addChild(bullet);
               MovieClip(parent).checkCollisionWithEnemies(this);
MainShapeShooter class
Code:
function onEnterFrame(event:Event):void
               if (player.hitTestObject(enemy))
                    health.meter.width--;
                    player.gotoAndStop(2);
                    else
                         player.gotoAndStop(1);
                    Collision.block(player, enemy);
                    Collision.block(player_C, enemy);
          function checkCollisionWithEnemies(bullet:MovieClip)
               //Enemy
               if (enemy!= null)
                    if (enemy.hitTestPoint(bullet.x, bullet.y,true))
                         enemy.meter.width -= 10;
                         enemy.gotoAndStop(2);
                         if (enemy.meter.width < 1)
                              enemy.stop();
                              removeChild(enemy);
                              enemy = null;
                         removeChild(bullet);
                         bullet = null;
The last 3 lines of the player class;
Code:
var bullet:Bullet = new Bullet(bullet_Vx, bullet_Vy, bullet_StartX, bullet_StartY, "square");
               parent.addChild(bullet);
               MovieClip(parent).checkCollisionWithEnemies(this);
shouldn't this allow/link to "function checkCollisionWithEnemies"  function within the MainShapeShooter class to allow the enemy to detent  the bullets. Maybe I'm missing something? :s
Any help would be greatly appreciated.
Thanks
Jonesy

I ended up going to the Apple store at Chermside (Brisbane) and the Genius could not have been more helpful or apologetic about my broken iPhone. Was changed in 7 minutes, I timed him:).
Now if I can get the wifi problem solved everything will be great.
Adrian

Similar Messages

  • Hello.I wanted to upgrade my iPad 1 to iOS 5.1 Over the Air.I was running iOS 5.0.1.It said it had an error connecting to server.It is already 5 hours i cant install this update.I also have an iPhone 4 with iOS 5.0.1 with the same issues.Help please!

    Hello.I wanted to upgrade my iPad 1 to iOS 5.1 Over the Air.I was running iOS 5.0.1.It said it had an error connecting to server.It is already 5 hours i cant install this update.I also have an iPhone 4 with iOS 5.0.1 with the same issues.Help please!

    You're probably running into the servers simply being swamped. Thousands of people are all going for the software update at the same time. Give it a try again and if that doesn't work, then try plugging it into your computer and trying it that way.
    I didn't get a notion of the size, it doesn't seem to be as big as the 700 meg 5.0 update, but it did take me 20+ minutes to download via cable internet so it's a large file. That in and of itself takes a while.
    If you're trying to download it directly to your iPhone, you'll need to be on wifi since I'm sure it's well over the 20 meg file size limit for 3G.

  • Recently i upgrade my iPad2 to 7.1(11D167) and now the wifi connection is very weak, I am not sure if it is a hardware or software issue, help please!

    Recently i upgrade my iPad2 to 7.1(11D167) and now the wifi connection is very weak, I am not sure if it is a hardware or software issue, help please!

    I am not sure, I have full signal on my iphone 5  and just 1 dot on my ipad, tomorrow I will test connection with other router and network, I thank you for your help and I will tell you the test result when done

  • N8 wlan and hard reset issues, help please

    Have a nokia N8, after installing Connectivity analyser beta from beta labs, my wifi reception has become very poor. i ave a wireless N router and before this date the signal was very strong. my friend has an N8 also, he tested the rooms i was having signal issues to see if the router was the problem, however he had excellent signal, leading me to think it was my phone. i uninstalled the app and he weak signal remained, i did a factory reset and the problem remeained, i did a hard reset and the problem is still there, I now have the added problem of no Ovi Suite and other Qt related app issues. Help please, this is really annoying. btw this is my second N8, really getting annoyed at Nokia now. any further specs, please ask

    As synth_fg rightly points out it takes quite a bit of tinkering to recover from "hard reset" on N8. To give you an idea what would be involved:-
    Download from Ovi Store website the sis installer of WordPress and install it on phone (wordpress install also Nokia Smart Install and all QT and PIPS components)
    Launch Ovi Store on phone: which will download the .sis installer and should work without any error
    Reinstall Social_1_2_update.sisx from here: http://nmota.messaging.nokia.com/clients/Social_1_​2_update.sisx
    At this point you are still without OVI Maps but you can install v3.06 pre-release from Nokia Beta Labs: http://betalabs.nokia.com/apps/ovi-maps-306 which will allow you to pinch to zoom on your N8
    Happy to have helped forum with a Support Ratio = 42.5

  • I am getting an error when I connect my Ipod, I have used it on this laptop before but now it is saying "Ipod detected, but it could not be detected properly"  Help please!

    I am getting an error when I connect my Ipod, I have used it on this laptop before but now it is saying "Ipod detected, but it could not be detected properly"  Help please

    You can try going through this troubleshooting document
    iPod nano: Error message saying that iPod 'could not be identified properly' - Apple Support

  • Login Issues - Help please

    Hi All-
    I had to reinstall the OS system and now it is asking for a login. Not sure what it is-so I go back to the start up cd hold down C get to change password. Change password as system admin (root level). Quit installer and restart the mac. enter my name and the new password the screen shakes and drops out the password. What am I doing wrong?
    Help please.
    LB

    Hi Sherry-
    Thanks for the info - Just a brief history on my problem.
    I was trying to open an application on the mac and it froze - nothing would work. I powered down at the surge protector. restarted to have the mac hang on the grey screen with the apple. Let it sit for 15 min with nothing. Called and apple dealer near us and was told to reinstall the OS. I had to do an archive & install. I think I had 10.3.9 but the system cds were 10.3.1 or something like that. So reinstalled and you know where I am. SO, should I still restore the netinfo data base? Will this effect my network with others. I back up my HD to another mac at night and vicea versa.
    Thoughts.....
    Thanks for your help!
    Larry

  • 64-bit Smart View + Excel 2010 64-bit Issues - Help Please

    Hello everyone.
    First, I am not an "IT guy" so please bare with me as I am not technical but need help.
    I am running Windows 7 64-bit Professional and Excel 2010 64-bit. I installed Oracle Smart View for Office, Fusion Edition 64-bit as an add-in within Excel.
    I have worked with our "Hyperion Admins" to connect to the right server so that my "private connections" are set correctly (hopefully that makes sense).
    However, when I attempt to refresh my Smart View query I end-up retrieving no data. The "refresh" button under "Smart View" in Excel will proceed as a refresh is occurring but then not return data (I know this Smart View template works as I've used it many times on 32-bit Excel).
    Our admins have informed me that I cannot use 64-bit Smart View because our "server" is on a 32-bit O/S (or something similar to that). To me, the logic doesn't make sense and I'm hoping that there is a solution the admins are not aware of.
    Happy to answer any questions and appreciate any help.

    JDN wrote:
    We had a similar experience as JTF, HsGetValues would not work but the AdHoc function worked fine. I put in an SR with Oracle and they refereced the below document. We ended up having IT install 32 bit office on the machine along with 32 bit Smartview (11.1.2.2.300) and now it is working fine.
    Regards,
    Jason
    Some Smart View Functions Do Not Work in Excel 2010 64-bit. [ID 1463814.1]
    To Bottom
    Modified:Aug 30, 2012Type:PROBLEMStatus:PUBLISHEDPriority:3
    Comments (0)
    In this Document
    Symptoms
    Cause
    Solution
    References
    Applies to:
    Hyperion Financial Management - Version 11.1.2.2.000 and later
    Information in this document applies to any platform.
    Symptoms
    When using Smart View (SV) with Microsoft Office 2010 SP1 some SV functions do not work or cause Excel application to crash.
    Cause
    In 64-bit versions of Excel 2010 SP1, the presence of Smart View functions may cause Excel to terminate abruptly and may prevent Copy Data Point and Paste Data Point functions from working. This has been identified as a defect in Microsoft product.
    Solution
    Use the 32-bit version of Smart View until Microsoft issues fix for their 64-bit Office products.
    References
    @ BUG:13606492 - USING HSSETVALUE FUNCTION CAUSES EXCEL CRASH
    14091219
    Related
    Products
    •Enterprise Performance Management and Business Intelligence > Enterprise Performance Management > Financial Management > Hyperion Financial Management > Smart View > Smart View
    Keywords
    BIT;CRASH;EXCEL;HSGETVALUE;MICROSOFT;OFFICE 2010;SMART VIEW;SMARTVIEW;SP1;DYNAMIC ADV PROBLEM SOLUTIONCan you use the 32-bit Smart View with 64-bit Office? Unfortunately, 32-bit Excel cannot handle my files so I am forced to use 64-bit so going back to a 32-bit Office will not work for me.

  • Compressor is having filter issues, help please!

    Hi, please help if you have seen this problem or know how to fix... and thanks in advance!
    I am exporting a QT to Compressor, and put a Noise Reduction filter on the file... But when I submit the export, an error message pops up:
    Unable to Load Effects
    The following effects could not be loaded:
    Noise Reduction
    These effects will not be applied. Please install the appropriate effects and re-open the project.
    I haven't deleted anything, especially not these type of filters... I hope Compressor isn't corrupted or something. And it especially heartbreaking, since this is the LAST step of a 2 month DVD project!
    Anyway, I'm praying someone knows the solution, or a way to re-install the filters... my software is far away at the moment!
    Thanks.

    Ouch. I believe your only option is to reinstall Compressor (since something within the program's code is hosed).
    Since you don't have your discs accessible, your best bet is to go to the FCS download site and manually install the Pro Applications Update 2008-05 package. You'll need your FSC serial number handy (should be able to find that in the About window of any of the FCS apps. For instance: Compresor > About Compressor, from the menubar)
    Just one caveat: in case you weren't on the latest updates (we all have our reasons for not upgrading) this will update your system. So please be mindful of any OS X/QT compatibility issues. Not mention bumping up the versions of your apps in this whole process.
    But this is only an educated guess. Never come across this myself.

  • I can not get my 8310 to be detected. HELP PLEASE!

    For some reason I was having problems with my 8310 and the keypad. I tried to unlock it and the keypad wheezed out on me and wiped my blackberry clean. Went to att. But they looked at me stupid. I downloaded the device manager but now it's not detecting my phone. Wrong password? What? I don't know what to do. Please help!

    to fix the BB from whipping out add memory stick

  • ITunes-iPhone music syncing issue, HELP PLEASE!

    Hi, after having some hardware issues with my iPhone 5, Apple replaced it with a new one.
    I restored everything from my iCloud backup with no problem and it downloaded all of my iTunes Store songs on the phone without any issues and as I plugged my phone into my 2010 MacBook Pro to put some new songs to it from a CD I just bought, ALL of the songs that I have on my phone that I bought from the iTunes Store were duplicated as grey 'ready to sync' songs. But they were not syncing. So I deleted all music and videos from my phone (by the way, I always use the Manually manage songs and videos function in all my devices, never did auto-sync) thinking maybe if i drag everything from my computer it'll change, but it won't! Whenever I click on 'sync', the grey songs appear. And the grey songs are only the songs that were bought from the iTunes Store and the songs I used to have on the other iPhone, that are in the iCloud backup. I've tried almost eveything for the past 3 days and finally gave up and decided to ask for help. If anyone can help me i'll be extremely grateful, thanks.
    My iPhone 5 is running on iOS 7.0.6 and 11.1.4 on iTunes
    ps: Please feel free to ask anything if I didn't explain it too clearly, English is not my main language.

    Im unable to assist you with the mac/mail side of the house. If you had outlook then I could assist. My thougts would be...With your phone plugged into iTunes, go to the second tab and confirm that you have contacts checked to sync between your computer/phone...if you don't then it will just transfer all your 0's and 1's to digi land. Contacts and calenders sync with your calender software, iTunes is just the conduit to get it there. I would also recommend that when you get your contacts back on your computer that you create a backup file in case this happens again, then you can just restore it. Hope this all helps.
    Good Luck

  • Hi I have copied over my iTunes to a new PC and now there are songs missing and when try to re download on iTunes it says play. When you hit play it sends you off to search for a file that doesn't exist. When syncing it says 100 issues Help please

    Hi,
    I have just put my iTunes on a new laptop by hard drive method and some songs are not there. When I go into iTunes it's doesn't say download or purchase it says play.
    So you press play and it opens a separate box saying search for file which isn't there.
    I have read tons of stuff re this but still not got it fixed. It's not a HD issue because iTunes won't let me download it why ?
    Hopefully someone can help
    Thanks David

    Hey Davidl678,
    Thanks for the question. It sounds like you are unable to download the purchases from your purchase history, because iTunes believes the songs to be in your library. It may be necessary to delete the items from your library, then re-download from your purchase history. Before doing so, you may want to take note of which song are available for re-download:
    iTunes 11 for Windows: Delete songs, playlists, or other items
    http://support.apple.com/kb/PH12359
    iTunes 11 for Windows: Download previous purchases from the iTunes Store
    http://support.apple.com/kb/PH12491
    Thanks,
    Matt M.

  • TreeMap class and message not understood issues - help please

    Can anyone help with this one please?
    The code is the start of a Map interface/TreeMap class to hold names as keys and addresses as values (both Strings).
    I think the instance variable and the constructor are correct, but the addAddress method throws an error
    Semantic error: Message addAddress( java.lang.String, java.lang.String ) not understood by class'java.util.TreeMap'.
    I can only guess that I've overlooked something quite simple? The line at the end of the code should read
    "Replaced "old address" with "new address" for "new name" and this should only display if the key already exists in the Map,
    hence the if statement. The keys and values have been declared as Objects for future flexibility. Sorry if this is all blatantly obvious.
    Also if I wanted to test this code and create an instance of the Addressbook class, what should my code look like?
    Many thanks.
    {code}import java.util.*;
    public class Addressbook
    private static Map<Object, Object> addresses;
    public Addressbook()
    super();
    this.addresses = new TreeMap<Object, Object>();
    public static void addAddress(String name, String address)
    if (addresses.containsKey(name))
    addresses.put(name, address);
    System.out.println("Replacing " + addresses.remove(name) + " with "
    + addresses.get(name) + " for " + name);
    else
    addresses.put(name, address);
    {code}

    If you're only going to store Strings in the Map, make sure you are specifying them as generics so that all operations return Strings by default.
    You don't need to use contains if you are going to replace a map value. The old value will be returned when you place the new one in. Should be quicker, since you're not searching for the same key twice.
    Do not refer to a static variable with this. it become confusing and could result in bugs. That said use static sparingly.
    The AddressBook should probably be an instance and all the variables and methods should be instance variable and methods.
    I don't know your requirements however so I'll leave this as a suggestion.
    import java.util.*;
    public class AddressBook {
       private static Map<String, String> addresses = new TreeMap<String, String>();
       public static void addAddress(String name, String address) {
          String oldAddress = addresses.put(name, address);
          if(oldAddress != null) {
                System.out.printf("Replacing %s with %s for %s%n", oldAddress, address, name);
        public static void main(String[] args) {
            addAddress("me", "123");
            addAddress("me", "321");
    }Brushfire,

  • I'm having restore issues, help please!!!

    this has probably already been answered, but got new 8gb iphone today plugged it in etc it crashed tried to reboot and reconnect to itunes, told to restore tried failed error code 13 checked forum changed usb bingo it starts to restore, now though the progress bar on the phone is full but on itunes it's saying it's still waiting for iphone been like this for almost an hour can anyone help, i've not even made a phone call from it yet!
    Message was edited by: sscsukltd

    sorry... can't help, not having these "restore" issues (yet...) and I've done 4- Restore to Backup the past week and two "restore to new Phone" and no issues... other than the fact that with a "Restore to New Phone" my 3rd party data app's are not "recoverable" as with the "restore to backup"

  • No Chrome still having issues, help please.

    Hey guys,
    I am trying to learn how to do NO CHROME windows. I have a
    small AIR Application which would like to make it without chrome
    and have tried the online tutorials but not having much. I am able
    to get the window to appear without chrome but with my original
    window, i have another window with systems setting pops in as well.
    Can anyone help me, please.
    Here is my code:

    To make an AIR app without chrome, you don't have to create a
    child window. The app itself can have no chrome. Here are the
    requirements for a no-chrome app:
    FIRST, in <mx:WindowedApplication> set the attribute
    showFlexChrome="false".
    SECOND, create an Application Descriptor XML File in the src
    folder named with your app's name, and with "-app" appended, as
    follows:
    my app startup file is src/nochrome.mxml
    my descriptor file is src/nochrome-app.xml
    (Note that this is an XML file, not an MXML file.)
    This Application Descriptor File "ADF" is normally created
    for you automatically when you use the Flex Builder wizard to
    create your AIR app. If it's not already there, then you'll need to
    get the contents just right. For now, I'll assume you have that
    file already but haven't used it; if you're not using Flex Builder,
    then let me know and I can post the contents of a default
    Application Descriptor File. But I highly recommend using the Flex
    Builder new file wizard to create your app.
    In the ADF, there are two settings to change; here are the
    values they should be set to:
    <systemChrome>none</systemChrome>
    <transparent>true</transparent> (this is
    OPTIONAL)
    If you're editing the automatic ADF created by Flex Builder,
    be sure to remove the comment prefixes and suffixes, or your edited
    settings will remain comments and therefore be ignored.
    Now your app will have no chrome and (if you set the
    transparent property) will also be transparent. So you'll want to
    drop at least an EXIT button on the Design page, so there will be
    some way to close it! You can use Debug Mode in Flex Builder to
    stop the app if there's no visible way to end it.
    If you are using transparency too, then the app itself (the
    WindowedApplication object) is transparent, so you would typically
    add a canvas component to the app's window, and use that for the
    app background. For irregular shaped apps, you might use an image
    component with a PNG image containing transparency. Or, you could
    use code to draw directly on the invisible window. Whatever other
    components are dropped on the invisible app window will be visible,
    and will appear to float over the desktop.
    If you don't set transparent to True, then the app will be
    visible, but will still have no chrome. But I suspect that if
    you're experimenting with no chrome, you'll very soon be
    experimenting with irregular shapes or other forms of transparency.
    hope this helps,
    Allen

  • Macbook permission issues-Help please asap...

    On my macbook there are no issues with administrator but with a normal user account there are. It started a couple of days ago and since I have tried all sorts of stuff but nothing works.
    Basically I cannot save an image when I click on the option 'save image as...' I can only use the option 'save to downloads' when I try 'save image as..' this error comes up...
    "The document “kate0802_302x322.jpg” could not be exported as “kate0802_302x322”. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info."
    Also I cannot take any screenshots and this error somes up...
    "Your screen shot can’t be saved. You don’t have permission to save files in the location where screen shots are stored."
    Furthermore I cannot save documents this error appears...
    "The document “Untitled” could not be exported as “work”. The file “/Users/Saira/Desktop/work.doc” couldn’t be found."
    I have checked all the "get info.." sections and I have permission to read and write I also tried restarting the macbook as well as strating it up in safe mode but it still doesn't change the same errors appear. However this problem is only on one user and not on the administrator account or any other general users. So now I literally cannot do anything and I've tried and checked verything I know. Can anyone help me solve this annoying problem?

    Hi thatkidsodope,
    I'm sorry to hear you are having issues with your MacBook Air. If you are still having issues with your Air unexpectedly freezing, shutting down, or restarting, you may find the troubleshooting steps outlined in the following article helpful:
    OS X: When your computer spontaneously restarts or displays "Your computer restarted because of a problem."
    Regards,
    - Brenden

Maybe you are looking for

  • Not a valid photoshop document after time machine recovery and reinstall of photoshop

    After a time machine recovery most of my photoshop documents recovered fine, however there are a select few (and my most recent work unfortuantely) that seem corrupt. It isn't all of my documents. Trying to recover them again from back-up doesn't see

  • Photo stream sharing

    It seems from everything I read that this new option in IOS6 is all about sharing specific pictures into what Apple calls a "stream".  What I was really hoping for was that I could share my photo stream that is on my phone with my wife's icloud accou

  • Picture not showing in Crystal Report Viewer

    We have an asp.net web solution that shows Crystal Reports using the crystal report viewer and also exporting the reports to PDF, Word and Excel The reports are working fine, but when showing the reports in the crystal report viewer the picture in th

  • Time Machine: "Partially Deleted Backup"

    Last night, after Time Machine performed a backup and began its post-backup thinning, it got stalled on "Finishing backup... ." The system log showed that it was attempting to delete a previously partially deleted backup: Starting standard backup Sta

  • Language for SRM (LAC) Interface

    Hi experts! I can't find KAZAKH language pack for SRM (LAC). Is it possible translate SRM (LAC) interface manually? Any help will be apreciated!