Sprite not seen by Director

Hey guys,
I have a massive problem that I've been struggling over for days now.  I have a green rectangle that a sprite can travel over.  I have code set up to tell me what colour the next Pixel along is, but for some reason the sprite is seeing the edge of the rectangle sooner than it should be seen.
I'm not sure whether I have explained that very well.
The file is here, you will see what I mean.
My problem is on the "Level 1" Marker.
Please can somebody help, I'm desperate for an answer on this as my deadline is near.

Try the following alterations to the script attached to your moveable character:
-- properties used in this script:
-- pSprite - the sprite reference
-- pSpeed - the speed the sprite should move
-- myLocH - the current horizontal position of the sprite
-- myLocV - the current vertical position of the sprite
property spriteNum
property my
property myReferenceImage
property myReferenceImageOffset
property myWidthOffset
property myHeightOffset
property pSprite, pSpeed, myLocH, myLocV
on beginSprite me
  -- initialise sprite properties
  my = sprite(spriteNum)
  myReferenceImage = member("Level_1_Maze").image
  -- reference bitmap is offset from (0, 0) by (9, 12)
  myReferenceImageOffset = point(9, 12)
  -- account for l, t, r, b colliding with "walls"
  -- regPoint is centered, so:
  myWidthOffset  = my.width/2
  myHeightOffset = my.height/2
  -- controls the speed that the sprite moves at
  pSpeed = 10
end
on keyPress me, aDirection
  -- actions THIS sprite should take on key press
  -- store current location
  myLocH = my.locH
  myLocV = my.locV
  -- find which direction to move
  case aDirection of
    #left:  me.goLeft()
    #right: me.goRight()
    #up:    me.goUp()
    #down:  me.goDown()
  end case
end
-- individual custom event handlers for movement
on goLeft me
  -- swap the sprite for one based on the
  -- left film loop cast member
  my.member = member("left")
  -- move the sprite to the left if no hedge to the left of the cast member
  newlocH = myLocH - pSpeed
  iColor = myReferenceImage.getPixel(point(newlocH - myWidthOffset, myLocV) - myReferenceImageOffset, #integer)
  if iColor = -16720640 then
    --grass colour is legal so allow move
    my.locH = newLocH
  else
    put iColor
    beep
  end if
end
on goRight me
  my.member = member("right")
  newlocH = myLocH + pSpeed
  iColor = myReferenceImage.getPixel(point(newlocH + myWidthOffset, myLocV) - myReferenceImageOffset, #integer)
  if iColor = -16720640 then
    --grass colour is legal so allow move
    my.locH = newLocH
  else
    put iColor
    beep
  end if
end
on goUp me
  my.member = member("up")
  newLocV = myLocV - pSpeed
  --find out if newLoc is a legal space
  iColor = myReferenceImage.getPixel(point(myLocH, newLocV- myHeightOffset) - myReferenceImageOffset, #integer)
  if iColor = -16720640 then
    --grass colour is legal so allow move
    my.locV = newLocV
  else
    put iColor
    beep
  end if
end
on goDown me
  my.member = member("down")
  newLocV = myLocV + pSpeed
  --find out if newLoc is a legal space
  iColor = myReferenceImage.getPixel(point(myLocH, newLocV + myHeightOffset) - myReferenceImageOffset, #integer)
  if iColor = -16720640 then
    -- grass colour is legal so allow move
    my.locV = newLocV
  else
    put iColor
    beep
  end if
end
This could do with a degree more rationalisation/optimisation/consolidation yet. For example:
-- properties used in this script:
-- pSprite - the sprite reference
-- pSpeed - the speed the sprite should move
-- myLocH - the current horizontal position of the sprite
-- myLocV - the current vertical position of the sprite
property spriteNum
property my
property myReferenceImage
property myReferenceImageOffset
property myWidthOffset
property myHeightOffset
property pSprite, pSpeed, myLocH, myLocV
on beginSprite me
  -- initialise sprite properties
  my = sprite(spriteNum)
  myReferenceImage = member("Level_1_Maze").image
  -- reference bitmap is offset from (0, 0) by (9, 12)
  myReferenceImageOffset = point(9, 12)
  -- account for l, t, r, b colliding with "walls"
  -- regPoint is centered, so:
  myWidthOffset  = my.width/2
  myHeightOffset = my.height/2
  -- controls the speed that the sprite moves at
  pSpeed = 10
end
on keyPress me, aDirection
  -- find which direction to move
  case aDirection of
    #left:
      tMember = member("left")
      tPoint  = my.loc - point(pSpeed + myWidthOffset, 0)
    #right:
      tMember = member("right")
      tPoint  = my.loc + point(pSpeed + myWidthOffset, 0)
    #up:
      tMember = member("up")
      tPoint  = my.loc - point(0, pSpeed + myHeightOffset)
    #down:
      tMember = member("down")
      tPoint  = my.loc + point(0, pSpeed + myHeightOffset)
  end case
  my.member = tMember
  iColor = myReferenceImage.getPixel(tPoint - myReferenceImageOffset, #integer)
  if iColor = -16720640 then
    --grass colour is legal so allow move
    my.loc = tPoint
  else
    put iColor
    beep
  end if
end

Similar Messages

  • 2 Lion Issues I have not seen addressed anywhere else.

    I hope someone can help me here. I have a couple of  problems with Lion that I have not seen mentioned anywhere. It's making me think that maybe I'm doing something wrong. Anyway here they are:
    1) Folder dates not accurate: This one has actually really caused me a lot of pain. I have 2 machines running Lion. One at work and one at home. I often carry files from one to the other using my USB flash drive. As I am updating a lot of files each day, I had come to rely on the folder modify date to make sure that I don't miss some small file. And as far as I know, I never missed a file... until I installed Lion. Since then, I have noticed, on both machines, that the folder dates do not always get updated when a file within the folders is updated. For instance, I have a database file which gets updated every day, but I have to remember to copy it to the backup because the folder date has not changed in over a week. I have no idea what makes it change, when it does.
    2) File transfers from Flash Drive unreliable: often when I am copying files FROM a USB drive TO my HDD (never happens in the opposite direction), the progress bar races along and finishes in a suspiciously quickly - (like in 1 second). To be honest, I've never checked at that point to see the status of the transfered files, but I know that it is impossible for them to have been transfered so quickly. I then drag and drop again. The second time it always progresses at a more expected pace and is always a successful transfer. It's never resulted in a problem for me, but it makes me feel a little insecure about the state of these transfers.
    (I am running 2011 imacs and using Lion 10.7.3)
    Thank you in advance for taking the time to ponder my issues.

    OK - got me. I have used Macs for an embarrasingly long time and I have to say, up until now I had no idea that the folder mod date relied upon the creation/introduction of new material into the folder.
    I have always relied on the modify date to help me sort out my files (when I am making changes to existing systems I often have a lot of copies of similar files/folders at different stages and for different media) -- it is difficult for me to believe that I never noticed that the directories did not get updated when existing files were updated... but hey - who knows... I'm doing a lot more, a lot quicker now. Perhaps I just had the time to be more careful before. Just goes to show you how great Macs are that someone can work as intimately as I do with them without knowing something that basic.
    I did test your info by transferring a file into that directory, and, as you said the modify date of the folder did change.... so you're definitely right, but somehow I feel that something else is going on here because I can't see how it explains what happened with the sudden change in the folder modification dates, this morning.
    At any rate, as you suggested, I will definitely have to modify my work habits.
    Thanks again, baltwo, for clearing up most of the mystery.

  • Ipod not seen by windows or itunes

    Hello, I'm totally frustrated and have been searching for hours. Please someone help.
    - Nano 8 gb
    - Windows xp
    Neither Windows (my computer) nor Itunes sees my ipod. Ipod is working fine: did the menu/select thing, cable is good.
    When I plug the ipod in the usb port I hear a bleep and I get a message bottom right "new hardware found ipod"and the icon is a usb cable. Ipod is not in My computer window. Ipod is not seen by Itunes
    Tried Device Manager/I see Ipod with a ? Yellow. If i right click on it and do update driver the ms computer management system crashes and sends error report.
    I tried dowloading the USB driver and placing it in the directory, but I got stuck because there is no windows/inf directory. I tried to update the usb driver with the same ms crash.
    I'm completely frustrated, please can someone help me.

    I was having the same problem the other day. I'm not sure what it was but I think it has something to do with the i tunes and i pod 1.2 update.
    What I did was:
    1. Uninstall i tunes
    2. Restart my computer
    3. pluged my ipod in a slow usb line
    4. waited until my pc recognized it in there. It took a little while.
    5. re installed i tunes from apple.com
    6. waited until i tunes recognized my ipod
    7. updated my i pod with my library it took a long time because i was in the slow usb plug.
    8. re plugged my ipod into a 2.0 usb line
    9. i tunes recognized it.
    10. I then updated my ipod to the new 1.2 version
    11. The problem started happening again
    12 I repeated what I did before and now it is working.
    It was very frustrating! I hope it works for you.1

  • 5th Gen IPOD - Won't Sync and Not Seen by Windows

    Help!!!
    Tried the 5 R's. I have the IPOD in Disk Mode but whilst it will happily charge, it still is not seen by ITunes or Windows Explorer (though is visible inDisk Defragmenter). I have already un-installed and re-installed ITunes etc.
    Prior to putting it into Disk Mode the IPOD still had my library on it and owuld happily work.

    Have you had a chance to look at these troubleshooting pages? They may be of some help:
    iPod missing in My Computer and in iTunes
    iPod is not recognized properly by computer when USB drivers are not installed properly or are out of date
    If you are using a laptop, this page might help: iPod not recognized when connected to Windows laptop over USB

  • IPod touch: Seen by XP, not seen on OSX.

    Strange one.
    1st Gen ipod Touch with latest software(think its 3.3), latest version of itunes.
    Its seen and works perfect with Windows XP.
    I plug it into my Mac Book Pro, running Lion and its not seen. nothing happens wihen i plug it in.
    I have reset, restored and wiped the ipod from the device itself and its still not seen.
    I also tried it on a Win 7 machine and its NOT seen either.
    Is this something crazy to do with 32bit architecture. Its seen on Win XP which is 32 but not by  64bit Lion and Win 7.
    Any suggestions?

    Have a Look Here
    Device Not Recognised
    For PC
    http://support.apple.com/kb/TS1538
    For Mac
    http://support.apple.com/kb/ts1591

  • HT4356 My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    hi
    could you tell us what the other app is please

  • Attachments and history of my emails are not seen by Windows users

    attachments and history of my emails are not seen by Windows users

    Just guessing at what you mean, try this:
    In Mail, while composing a message, go to Mail's menu and click:
    Edit > Attachments > Always send Windows-friendly attachments

  • In my iPad mini some apps are not seen (voice recorder, calculator, compass etc)

    in my iPad mini some apps are not seen (voice recorder, calculator, compass etc)er

    Those apps aren't included in iOS on iPads
    iPad Mini built-in apps : http://www.apple.com/ipad-mini/built-in-apps/
    iPad manual (which has a chapter on each of the built-in apps) : http://support.apple.com/manuals/ipad/

  • Data of measure is not seen in  webi report when drill is disabled

    Hi
    i have created a hierarchy in universe on which i drill down in webi reports
    the problem is that  i have drilled my report till the last level and saved it
    the object  on which im drilling  is set as a section in the report
    so i have added a measure in the table under that section
    now the measure has different value at different level of drillings
    i.e for the last level of the drill i use one measure and after that as i drill up i use different  measure
    for all other level of drilling
    every thing is working fine but the problem  is
    when i open report in view mode
    the measure data is not seen
    only when i enable drill the measure data is seen
    i have done something like thi
    i have used drillfilters in webi reports for checking which level we are in drill mode so as to display the measure value based on drill level

    Seems like DrillFilters needs the drillmode to work fine..
    why don't save the report with the drill button enabled?

  • After upgrading to Mountain lion the hyperlink button is not seen in Preview.  Anyone knows ho to get it back?

    After upgrading to Mountain lion the hyperlink button is not seen in Preview.  Anyone knows ho to get it back?

    Augend wrote:
    After upgrading to Mountain lion the hyperlink button is not seen in Preview.  Anyone knows ho to get it back?
    There have been a few threads about this.  The feature seems to have gone missing in Mountain Lion even though the Help for Preview still mentions it.
    I've filed a bug report on it.
    Matt

  • The salesperson for my iphone 4 said on Christmas morning we could go to our online account, select my number, select to change my SIM card, and enter the ICCID number so that I'd be able to use my iphone 4 today. I have not seen any such steps. Help?

    The salesperson for my iphone 4 said on Christmas morning we could go to our online account, select my number, select to change my SIM card, and enter the ICCID number so that I'd be able to use my iphone 4 today instead of my old phone (not an iphone). I have not seen any such steps. Help?

    I suspect the salesperson that told you that meant your online account with your carrier...have you tried logging into your carrier account online? To do this will require the sim number on your sim card, as well as the phone's IMEI number...you get the sim number off the sim card & the IMEI number, for the phone, is printed on the box.

  • I have migrated a user's mysite in sharepoint 2013 from one domain to another.The issue is that old activtiy data i.e newsfeed data is not seen

    For eg :
    I had a user called domain1\user1 whose mysite was created as http://my/personal/user1.
    Now this user moves to another domain say domain2\user1.Since mysite is already present no new mysite will be created.
    Move-SPUser –Identity "domain1\user1" –NewAlias "domain2\user1"After executing the above query,user is migrated and is able to login to the mysite.But the newsfeed data is not seen.I can see it in the microfeed list but not in the newsfeed page.All other data like documents ,tags,people etc is present
    harsh damania

    it should move all the profile data alonwith, i would check the ULS logs for any clue.
    also make sure following timer jobs ran successfully
    User Profile service application name - User Profile to SharePoint Quick Synchronization
    User Profile service application name - Feed Cache Repopulation
    User Profile service application name - Activity Feed Job
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • I like and use Top Sites but it has become unsuable with this constant blacking out and reloading the thumbnails.  My MBP has not seen a problem at all.   I have been searching every other day for over a month trying to find a fix in Windows Safari with n

    I like and use Top Sites but it has become unsuable with this constant blacking out and reloading the thumbnails.  My MBP has not seen a problem at all.
    I have been searching every other day for over a month trying to find a fix in Windows Safari with no joy.  I want to resolve, not switch browsers. Please offer up a solution that only refreshes the Top Site thumbnails once a day or as some controlable interval.  Started about two versions ago, now on ver 5.1.5. Windows 7 64bit.
    Safari 5.1.5 for Win64 bit, Windows 7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    I think I solved the wifi connection problem, just by switching off completely the router! sounds trivial, but in this case it worked!!!
    the funny behaviour of the trackpad/cursor still persists. any suggestion???
    thanks again

  • Cd drive on my laptop not seen as a device. Can refresh itunes and device appears but get unknown sync error 13019 when transferring cd's to my nano.  The cd's appear on the nano when it's connected to itunes but aren't there when I disconnect?

    cd drive on my laptop not seen as a device. Can refresh itunes and device appears but get unknown sync error 13019 when transferring cd's to my nano.  The cd's appear on the nano when it's connected to itunes but aren't there when I disconnect?

    Satellite L675-S7113 Specifications (PSK3AU-07C02S)
    Satellite L675-S7113 Support Page
    rwls wrote:...since I got it 3 years ago I've been unable to burn an audio CD from ITunes or Windows media although it worked once after the computer had been shut off for awhile..and didn't find the problem until after my warranty had expired...
    From your statements above, it sounds like you never tried to burn a CD for at least the first year that you owned the laptop, as it had a one year warranty on it. While you might have used it frequently to install software,  play DVDs, Blu-Ray disks, etc, that's unclear from your statements. Nonetheless, it might just be dirty-dusty. So, before deleting-uninstalling any software, and given they're cheap, try a CD-DVD Cleaner Disk first and see if that resolves your problems.
    Let us know what happens. Good luck.
    Mike

  • My iphone4 is not seen on itunes. When I plug the iphone the device does not recognize it but the pc recognizes it as a camera or something. What can I do?

    My Iphone is not seen on itunes when I plug it. I've tried everything that I found on the internet. but it still doesn't work, so I can't sync my iphone. What can I do? I have checked all the USB ports, I have desinstalled and installed again itunes, and I have run out of ideas.

    When you plug it it, it should recognize it as an Apple IPHONE under devices. It will then bring the Camera/Connection wizard for the photos on the device. When you plug into different USB, it should bring the hardware wizard and tell you what its installing, what happens?
    Under Device Manager, under Imaging Devices it will show up as Apple IPHONE. Is this being shown in your computer?

Maybe you are looking for

  • GridControl Management Agent on HP-UX 11.00

    Althoud not supported, we would like to install the grid control agent on an older hp-ux 11.00 machine. We've installed it on a new machine, and copied the software to the old server. anyone any exp. with this?

  • Report using colmns from 2 subject areas

    Hi, I have to buld a report as below Product      ForecastRevenue(A)       ActualRevenue(B)       Variance A                200                                      100                           100 B                200                               

  • PO user exit for payment terms release strategy

    Hi friends, My requirement is to any changes to Payement terms in PO should trigger the re-release of the po.... Plz. explain... How to proceed... which user exit i have to use........ Thanks in advance, Navin.....

  • Alpha channel in initial video

    whether i am using premier or final cut, exactly how would i encode and save an alpha channel (to use in flash) in my video before i import the video into the flash video encoder. what setting(s) do i use in these programs? i am shooting the video wi

  • 2 nodes RAC with Oracle 10g on Windows 2000 server

    Hi at all. I want to manage a cluster having 2 nodes on windows 2000 server each of them with Oracle 10g. I have VMWare 5.0. Someone can suggest me a detailed tutorial how to start and built it? Thank you very much for your answers. Saverio Sergio Mo