Moving enemy to a random available tile

I have an enemy hitting a bunch of tiles, and through a loop, I check all the tiles if the enemy is hitting them. I trace them and some will tell me if it's true or false. Although you can't see tileset, it is an array that is equal to a movieclip that is a tile. It is in a for loop itself, so basically, tileset is 49 movie clips of tile. I want to be able to get the enemy to randomly choose from those that are true, and go on those tiles. It traces all the tiles that are in contact with the enemy, and I push those into another array called options. Below is my timer function, where every 5 second, I want the enemy to move to an available tile. My problem is, I'm not sure how I can get the enemy to move randomly into those available tiles.
function timerenemy (event:TimerEvent) {
                    var options:Array = [];
                    for (var j:int = 0; j < tileset.length; j++){
                        if (tileset[j].hitTestObject(enemy) && ! tileset[j].tileMiddle.hitTestObject(player)) {
                            tileset[j].outline.gotoAndStop("attack");
                            options.push(tileset[j]);
                        if (options.length > 0){
                            var enemyPick:int = Math.floor(Math.random()*options.length)
                    trace(enemyPick, options);

use:
function timerenemy (event:TimerEvent) {
                    var options:Array = [];
                    for (var j:int = 0; j < tileset.length; j++){
                        if (tileset[j].hitTestObject(enemy) && ! tileset[j].tileMiddle.hitTestObject(player)) {
                            tileset[j].outline.gotoAndStop("attack");
                            options.push(tileset[j]);
                        if (options.length > 0){
                            var enemyPick:int = Math.floor(Math.random()*options.length);
enemy.x=options[enemyPick].x;
enemy.y=options[enemyPick].y;
                    trace(enemyPick, options);

Similar Messages

  • Moving where Uverse is not available

    Hi,
    I found out that due to my job relocating my family and I will be moving to lake Los Angeles. My wife called to get some information about moving and was informed that not only are we moving out of AT&T network so Uverse is not available but we are going to also be charged an early termination fee. We were under the impression that if we are moving to an area with no Uverse option that we would be let out of our contact with no fees. Not only was she rude to my wife, but why would we be penalized for canceling our contract when we don't even have the option to move it with us. We have been customers with AT&T for a long time and until today have never had any issues. Please let us know what our options are.
    Thank you,
    Ryan

    Ryanjones891 wrote:
    Hi,
    I found out that due to my job relocating my family and I will be moving to lake Los Angeles. My wife called to get some information about moving and was informed that not only are we moving out of AT&T network so Uverse is not available but we are going to also be charged an early termination fee. We were under the impression that if we are moving to an area with no Uverse option that we would be let out of our contact with no fees. Not only was she rude to my wife, but why would we be penalized for canceling our contract when we don't even have the option to move it with us. We have been customers with AT&T for a long time and until today have never had any issues. Please let us know what our options are.
    Thank you,
    Ryan
    What was the source of that information?

  • Moving images within projects - random placement

    I have tried to move images within a project, slotting them in a different order than shot. All of a sudden the images are not going where directed - they appear to be placed at random within the project. This is driving me crazy now.
    Has anyone else experienced this? Retarting doesn't seem to help. Maybe I need to shut down....

    Thanks for your reply. I guess I mistakenly thought that if you created an album within a project, any images placed in the album would also become part of the project. So what's the best way to sub-divide or categorize images within a project? For example, if I have a project called "architecture" and within that project I have images of "commercial" and "residential".
    I thought if I had a project called "architecture" and inside that I put two albums called "commercial" and "residential", I could drag groups of images into the albums and still see all images by viewing the project.
    Thanks again,
    Andrew

  • Can we put margin for text inside available Tile Templates ?

    Hi all ,
            We are developing a windows phone silverlight 8.1 application. Using WNS as push notification service. For tile notification using the template "TileWide310x150PeekImage02" for wide tile . Text attribute with id 2 is
    appearing a little bit left as compared to text with id 1 .We need all texts inside tile should be on the same vertical line . Here is the Tile images for both square and wide tile . Also is there any way to change the square tile text to small size?
    Please tell me how to resolve it
    Thank you

    Here is a complete list of the tile templates:
    https://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx?f=255&MSPPError=-2147217396
    You could choose a different template to get larger text.  In your case you would use TextID 2,3,4,5 and eliminate Text ID 1 to get the text to align left correctly.  The TextID 1 is indented just a bit.
    Bret Bentzinger (MSFT) @awehellyeah

  • MOVED: Nahimic Audio Enchancer is available in msi ge series laptop ???

    This topic has been moved to GAMING Notebooks.
    https://forum-en.msi.com/index.php?topic=254305.0

    What's your model?
    GE60 or GE70?
    0Nx, 2Ox, or 2Px series?
    Currently Nahimic is only for newer models such as GE62 or GE72. It requires a specific version of Realtek audio drivers.

  • MOVED: 760GM-P34 (FX) Random Reboots after Radeon R9 290 install HELP

    This topic has been moved to MSI AMD boards.
    https://forum-en.msi.com/index.php?topic=253411.0

    Board: MSI 760GM-P34 (FX)
    Bios: Version 17.16
    VGA:  HIS R9 290 4gb ddr5 pci-e 3.0
    PSU:   Seasonic x750 Gold
    AMD FX-8320 125w 8-Core Vishera
    MEM: Ripjaws 16.0GB Dual-Channel DDR3 @ 666MHz (9-9-9-24)
    HDD: Seagate 2TB 7200
    COOLER:  Cooler Master Hyper TX3
    OC: No OC
    OS: Windows 7 64bit Ultimate SP1

  • Dock keeps moving to 2nd screen randomly

    I have a secondary screen on my iMac. Since updating to Mavericks, the dock, at random times, switches to my second screen I have to then go in to System Preferences > Dock > Change Position on screen to left then back to bottom so it goes back to my main screen. Anyone else have this problem? Or better yet, a fix? Thanks!

    The Dock is now on all displays in Mavericks. What you have to do is go down to where the Dock should be and try to push your cursor down again. The Dock will appear. Then, if you want to use the Dock on the other display, you will have to repeat the process there.

  • MOVED: SLI won't stay available on MSI Eclipse SLI mobo with 2 EVGA GTX 280s

    This topic has been moved to Intel Core I7 boards.
    https://forum-en.msi.com/index.php?topic=122254.0

    I have 2 GTX 280 running in SLI with the new driver 182.06 vista 64 bit and everything works just fine.
    First remove the physx software , than the nvidia driver with ad / remove programs in the configuration panel.
    Restart you PC than install the new driver (182.06 vista 64 bit) and the new physx software (9.09.0203) is automatically installed with the driver. This is how i did it.
    I use evga precision 1.4 tool for my GPU's and GPU-Z and there it is confirmed that sli is working as well in the nvidia controll panel.
    My motherboard driver is 1.4B3.
    CPU = i940 at 4083MHZ 177.6x23
    Mem= 12GB Corsair XMS3 1333 at 1420MHZ.
    PCI fix at 37.3.

  • Screensaver named Random not compatible with Snow Leopard

    Hello
    When I run my iMac under 10.6.1, it defaults to a tool which lup among intalled screensavers.
    So, from time to time it try to display a screensaver entitled Random.
    When it did, it displays a black screen and a white sentence: the screensaver named "Random" is not compatible with the operating system, contact the developer.
    Fine, it's an Apple product
    I moved it on the desktop so I was able to pack it in a zip archive (one never knows), trashed the true file emptied the trash and rebooted.
    I was sure that I would be free of the message.
    I was wrong, the message continue to appear.
    How may I really get rid of this beast ?
    Now, I assume that the app is using a list of items.
    Where is this list to get rid of it?
    There is no "Random" available in the ScreenSaver PrefPane.
    Thanks in advance.
    Yvan KOENIG (VALLAURIS, France) vendredi 2 octobre 2009 21:54:48

    Thanks,
    it just changed the error message.
    Now it no longer display "Random" but "Aléatoire".
    I found a workaround:
    I selected "Mélange",
    and disabled Plages which I dislike.
    Now I no longer get the black screen
    One more time I'm bored because I don't know the true explanation
    Yvan KOENIG (VALLAURIS, France) dimanche 4 octobre 2009 19:27:42

  • How to add or remove tiles at run time

    We are in the need to create following functionality through mosiac:
         1) Add tiles in layout at run time by user.
         2) Remove tiles in layout at run time by user.
         3) Option for minimize-maximize any tile in layout at runtime.
         4) Whenever any tile is minimised or removed from the layout, its operation should not run while loading the tile.
         5) User may create a layout according to his wish using available tiles and this layout should persist for the user's session.
    Is it possible to create all above by using mosaic. If not, please tell me which options can not be created.
    I have gone through the sample code found on adobe site but those are too simple to explain my needs. If there are some other sample code(which can explain my requirement), please send me the links.

    1 + 2 is possible with Mosaic today. The ClientDashboard example (part of Mosaic standard samples) shows how a user can add tiles via a menu and remove tiles using the "x" close button in the tile chrome. Adding and removing tiles can be done through the Mosaic client API.
    3) Minimizing and maximizing tiles is not yet supported (but something high on our product backlog).
    4) When a tile is removed by the user it does not run anymore in the background
    5) If you define a dynamic layout (see the Client Dashboard example) the user can re-arrange tiles within the constraint of that defined layout and those changes can be persisted within the session as well as between sessions (user can save view). Users can not change the fundamental layout definitions defined for a panel (that needs to be done in the XML definition of the panel).
    Cheers,
    Matthias

  • Time and/or Date incorrect after moving/copying/importing

    This has been going on for years and has messed up hundreds, maybe more, of the time/date on my photos in Aperture.
    If I select my entire photo library (typically preset to 'Date - Ascending') in Aperture, I can find hundreds of photos out of order. When I look at them in 'Info', the time and sometimes date has changed by several hours. I'm not sure if this is an Aperture thing or Mac thing? Over the years I have moved and/or copied photos from smaller HDDs to larger HDDs to eventually a NAS unit and/or from iPhoto to Aperture.
    I have made calls to Tech Support, but they have always made me feel as if I made some mistake on my end or I didn't set the time correctly to begin with (now this could be correct with the P&S I share with my girlfriend, but very rarely with my DSLR). But I also explained that it was random (3 to 5 photos in a set).
    So today as I was trying to update some of my photos, I came across some photos (and videos) I took last year with my iPhone (my iPhone always has the correct time and date or 99.9%). I originally uploaded these to an old iPhoto library I still have (all the dates and times are correct). These same photos and videos (55 over a 3 day period) were moved to my Aperture library some time ago and 3 of the 55 have the incorrect time by -7 hours (ie. 3:30 pm is now 8:30 am).
    Why does this happen?? I have not set any time changes to these photos. If I did, they would all have the wrong time and not just 3 of them would be off.
    Is anyone having this issue and if so, was there a way to get the corrcet time/date from the photo hidden deep down in the EXIF? This is driving me crazy.
    Here are some screen shots of the same photo in iPhoto and Aperture.
    iPhoto 5:28:09 PM - Correct
    Aperture 10:28:09 AM - Incorrect -7 hrs
    TIA if anyone can help. I just don't have the time to go back and try and change all these photos.
    Narvon

    DF
    Thanks for the reply, I will try to post the screenshots again (they still show for me, odd?).
    Anyway, this is not a zoning problem. This is a moving or copying problem.
    The photos I tried to show from the screen shot I took last year at a concert in Coachella (same time zone as my residence in Redondo Beach). The shots were taken using my iPhone which has GPS and constant updating of Time. All the photos and videos show up correctly in Places (GPS) and all the correct times show in iPhoto.
    The issue occurs when the photos are moved to Aperture. Randomly the time has changed to -7 hours on a few photos. This same randomness has occured to hundreds of my photos that I have imported into Aperture over the years. As I said before, Tech Support and everyone else has placed the blame on me within my camera settings or improper importing.
    Now that I use my iPhone more often, I have proof that the settings are correct and that Aperture or Finder or ?? within Apple has changed the Time randomly. Also, if I had 'Accidently' opened the 'Time Zone' brick when importing (as suggested by Tech Support), all the photos would have the incorrect time and not just a few random ones.
    iPhoto original from iPhone - Time 5:28:09 correct
    Aperture photo from iPhoto - Time 10:28:09 incorrect -7 Hrs
    Thanks again,
    Narvon

  • Inventory Controlling - Get history moving average price function - Urgent

    Dear Experts,
    Currently I have an issue that I want to calculate material history value at storage location level for each month. I tried to get history stock quantity and value from table S031, stock quantity is correct. But stock value (goods receive value minus goods issue value in table S031) is not correct.
    Client requests the resulet should be same as transaction code MC.9 (valuation selection - standard). But what the result I got from table S031 is the value that without disctribution.  Currently I do not know how MC.9 calculate stock value.
    Does any expert know if there is a funciton that can get history moving average price. I may use this price multiply history stock to get history value. Thanks
    Best Regards
    Angela

    Hello,
      Moving average cost history is available in MBEWH-VERPR.
    Thanks,
    Venu

  • "Tiles cannot be displayed" error in Fraud Management web ui

    Hi, I'm trying to setup Fraud Management SP1 on NetWeaver. We done all steps from Fraud Management 1.1 SP01 (on SAP HANA) installation guide, but still have a small problem. When I logged to the application through Web UI client and opened one of available tiles I got the error “Tiles cannot be displayed; contact your system administrator”.
    I checked all OData services and authorizations, especially FRA_PERSONAL_SETTINGS_SRV. Looks like all of them are fine. I checked ICM logs, but there is nothing about this problem.
    Is there are any logs that can help to resolve this issue?
    thanks a lot for the helpful info.

    Hello Alexander
    if you are a SAP Partner please contact GRC-FRA component for such issues.
    Is this still an issue? Please check OSS Note #1932303
    Please also note that SP3 is at the moment the latest SP. SP04 is RTC on August 11th
    regards
    Nesimi

  • Playing a Playlist, then moving to another Playlist..?

    Ok, here's what i want to do,
    I want iTunes to play a certain playlist at a specific time (which I know can be done w/ iCal, I've got that so far) but when iTunes is done playing everything in Playlist A, I want it to start playing Playlist B.
    Example, I have a single track in a playlist, we'll call "Podccast Playlist." When that single track is done, I want it to start playing a playlist with a bunch of random tracks in it, called "Random Music"
    I could just figure out exacly how long the single track is and schedule ical to play it at the time its over, but that could be tricky, i'd rather it just moved on to the "Random Music" playlist and start playing immediately, after the "Podcast Playlist" is done.
    I don't want to dump it all into one playlist, b/c i want the second one to be all random.
    any ideas?
    Thanks in advance,
    Langley

    What about an AppleScript?
    I don't know if it would work or not, as I am not sure of the exact behaviors of AppleScript, but perhaps you can sequence the actions, and perhaps it will wait till one finishes before moving on?
    And perhaps Automator could be a solution.
    If I can think of a solid solution, I'll post back.
    Beavis2084

  • When will Infinity be available in my area?

    Im actually curious as to when the Burton on Trent exchange will be upgraded? We dont even have Infinity availability, and its something I would seriously consider moving to should it be available in my area.
    Any chance of a guestimate?
    Solved!
    Go to Solution.

    looking at BT openreachs latest list I would suggest like many other exchanges some time after 2012 there are potentially over 5000 exchanges and thousands of street cabinets to upgrade no small job
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

Maybe you are looking for

  • Formatted Search - Restrict to Only One Customer on Activity Window

    Hello Experts: Am trying to create a formatted search to provide a suggested RMA Number on the Business Partners > Activity window in a UDF. While in Activity, the user should get a list of ONLY the one customer they are currently working with.  So i

  • I don't trust my iPhoto Library!

    I am in the process of archiving old photos, and I would like to figure out the best way for me to do this. I have about 6,000 photos that span back to 2005 on my current laptop. I recently upgraded from my original operating system to Snow Leopard.

  • IPhone not sending POP mail?  Here's a work-around.

    Like some other people out there, I haven't been able to get the Mail App on the iPhone to talk nice to my POP email host's server. It receives mail just fine, but will not send. I've tried all the fixes I could find suggested out there, and had seve

  • Media Not Saved Error - Slide Duplication corruption suspected

    I've recently upgraded to KN '06 and have run into a nasty. When saving changes to a 60 slide presentation I've started getting "failed to save" messages about picture and movie media associated with the slides. It finally occurred to me what was cau

  • IMac Freezes Periodically During Screen Saver Only

    I own a late-2006 Intel-based iMac. Over the last few months, I've noticed that the iMac freezes when the screen saver is running. This doesn't happen all the time, and it doesn't matter what screen saver I use. (None of the screen savers is a third-