Follow sprite when the mouse is down, but randomly move when mouse is up?

I have a sprite that has a Random Movement behavior.
While the mouse is down, I want it to stop this behavior and initialize a Follow Sprite behavior instead.
When the mouse is lifted, I want to stop the Follow Sprite behavior and reset/restart the Random Movement behavior.
Openspark helped me out with a different version of a very similar behavior a long while back, which worked. It switched between Random Movement and Draggable. I tried to edit the code so that it would apply to Follow Sprite instead of Draggable, but it isn't working the way I thought it would.
The order of behaviors on my sprite is as such:
followSprite (Follow Sprite)
moveToward (The behavior described above)
randomMove (Random Movement)
turnTowardsMouse (sprite faces mouse when it is clicked)
Face Destination (if not facing mouse, sprite faces toward the randomized endpoints generated by randomMove)
This is the moveToward behavior - the middleman that's supposed to be swapping between the two:
property pSprite
property pTouching
on beginSprite(me)
  pSprite = sprite(me.spriteNum)
end beginSprite
on mouseDown(me)
  -- Overrule the Random Movement and Rotation behavior until the mouse
  -- is released. See the on prepareFrame() handler for the effect.
  pTouching = TRUE
end mouseDown
on prepareFrame(me)
  if pTouching then
    -- Block the event from reaching the Random Movement and Rotation
    -- behavior, so that only the Draggable behavior will work.
    if the mouseDown then
      stopEvent
    else
      -- The user has released the mouse.
      -- Start a new movement in the Random Movement and Rotation behavior.
      pSprite.pPath = VOID
      sendSprite(pSprite, #mNewPath)
      pSprite.pRotate = VOID
      sendSprite(pSprite, #mNewRotation)
      pTouching = 0
    end if
  end if
end prepareFrame
Can anyone help me figure this out?
If you want to imagine a visual, it's essentially a touchscreen fish tank. Fish swim around randomly, but when someone is touching the screen, they approach the point of contact (which is defined by a tiny invisible sprite centered on the cursor).
Once again, thank you so much to anyone who can help me out. This is part of a capstone undergraduate art project I am doing - and I am far more experienced in making the visuals than I am in coding. I am having to mostly tackle Lingo on my own. Any coding help I've received will be recognized (with permission) on my artist website as well as a thesis paper I am writing that will be published in May.

As first steps at troubleshooting you could try an SMC reset and a PRAM reset:
SMC Reset
Shut down the computer.
Unplug the computer’s power cord and disconnect peripherals.
Press and hold the power button for 5 seconds.
Release the power button.
Attach the computers power cable.
Press the power button to turn on the computer.
Reset PRAM
Shut down the computer.
Locate the following keys on the keyboard: Command, Option, P and R.
You will need to hold these keys down simultaneously in step 4.
Turn on the computer.
Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
Hold the keys down until the computer restarts and you hear the startup sound for the second time.
Release the keys.
If that doesn't help, what OS are you running? Depending on the OS (Lion/Snow Leopard) will help determine the next step.

Similar Messages

  • Iphone alarm doesn't work when the phone is charging but works fine when it is not plugged in, any reason for this?

    Recently my alarm hasn't been going off on my phone when it is plugged into the charger. This is a problem as i have work most mornings and have been late. When it is not plugged in the alarm works. I know it would mae sense to charge it before i go to sleep, take it off the charger, set the alarm then wake up but was just wondering if there was any reason why I might be experiencing this issue?
    Cheers

    This is something peculiar, normally that doesn't work that way
    when did this happen? if it just happened, then something probably went wrong with either the software or the hardware
    do charge the proper way, and see if it happens again
    or try completely draining the battery, and charge it to 100% and see if its gonna solve the issue with the alarm

  • When i type in the correct answer for my security question it always comes up as incorrect I have the answer written down but there not working can someone help

    hello
    when i type in the correct answer for my security question it always comes up as incorrect I have the answer written down but there not working can someone help

    Hi, Corinneact. 
    Thank you for visiting Apple Support Communities. 
    The usual cause for errors is that the security question responses are case sensitive.  If case sensitivity is not an issue with your answers, see the last step in the attached section of the article below. 
    Navigate to My Apple ID using your web browser.
    Click "Manage your account"
    When prompted, sign in using your Apple ID and password.
    Click Password & Security
    You'll be asked to answer 2 of your 3 security questions before you can make any modifications. If you are unable to remember your answers, you can choose to send an email to your rescue email to reset your security questions.
    Note: The option to send an email to reset your security questions and answers will not be available if a rescue email address is not provided. You will need to contact iTunes Store support in order to do so. 
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Cheers,
    Jason H. 

  • When I started my iMac, I could move my mouse cursor but I could not clik

    When I started my iMac, I could move my mouse cursor but I could not clik. Following some advices from the discussion board, I did run the safe mode. Nothing changed. Hence I could not log in. Need help, please.

    I am using an Apple Magic Mouse and up to yesterday there was no problem.
    This morning when I logged in, I got a note that my trackpad battery is low.
    I tried to close that notice, failed. I tried open finder, fail. I could move my cursor but could not clik. I turned off.
    Now here I am.
    When I started my iMac, I could move my mouse cursor but I could not clik. Following some advices from the discussion board, I did run the safe mode. Nothing changed. Hence I could not log in. Need help, please.

  • In my iPhoto library, only some images appear as thumbnails.  The rest are blank but appear briefly when scrolling through or properly when double clicked.  Any ideas?

    In my iPhoto library, only some images appear as thumbnails.  The rest are blank but appear briefly when scrolling through or properly when double clicked.  Any ideas?

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • Memory content lost when the battery runs down

    My computer sometimes saves memory content when the battery runs down, as it is supposed to, so that when it restarts it is restored to the state it was in,  but at other times it does not.
    Is there a way to find out why this is and fix it?

    Thanks for the reply.
    Doesn't Apple recommend that you do exercise the battery by using its full capacity? They even recommend running it down from full until the computer saves the contents of memory to the special file, then leaving it 5 hours before charging fully again.
    I have never heard of the 20% threshold before.
    The odd behaviour in my case is that the computer sometimes does what is should: saves the memory then shuts down and when started restores that data, but at others does not save the data first, and starts up normally when I plug in the power and switch on.

  • Is there a  requirement to restart the JMS/Weblogc Server everytime when the DB goes down?

    Question:
    When the Database is shutdown gracefully everything was fine.
    But when the Database is brought down with shutdown abort the MDB consumer will never consume messages from the topic again. And we need to restart the WebLogic Server in order to get the messages consumed again.
    So is there a requirement to restart the JMS/Weblogc Server everytime when the DB goes down? If not, what type of failures will require the JMS/WLS restart?

    On a DB failure, a WL JDBC store service will make a brief attempt to reconnect before shutting itself down along with any services that depend on the store. 
    It isn't necessary to restart the entire WebLogic Server JVM to bring the affected service(s) back if you can use the Automatic Service Migration feature.  ASM can automatically restart a failed service on a different WL Server in the same cluster, and/or can try a restart-in-place for the service if the service's original host WL Server JVM is still running.   The Automatic Service Migration (pdf) white-paper has a thorough discussion of this area.
    In addition to ASM, there's also a "whole server migration" option that can automatically restart or migrate an entire WL server.
    Tom

  • Mighty mouse scrolls down but not up

    why is my mighty mouse scrolling down but not up on my browsers?

    Usually it is accumulated crud: skin oils and flakes of skin and dirt, but some have been accepted for repair by Apple. Occasionally a restart fixes the problem. If not there was a recent discussion that yielded several promising suggestions:
    http://discussions.apple.com/message.jspa?messageID=2248877#2248877
    These included cleaning the ball with a soft cloth, cleaning the ball with a baby wipe, and disassembling the mouse to thoroughly clean the interior.

  • How to show  an error Page in Weblogic when the server is down

    Hi ,
    I heard that every container has the facility to show an error page when the server is down and (when the request has arrived at that time ).
    Please tell me how to configure this in BEA weblogic ??
    Thanks .

    Hi,
    From my understanding weblogic dose not provide the thing which you are asking for, reason is given below.
    - An application is deployed only on managed server one (MS-1)
    - Now if the request comes to the server (MS-1) when it was running and then for some reason MS-1 goes down then weblogic server would be able to send any response back to the client as its down.
    - Hence nothing can be done as the request object is been lost when the server goes down or even cant redirect to an error page as for doing that too the server has to be up and running.
    However there are other way round which can help you overcome this issue as shown below
    - Use Clusters with few managed servers in it which gives you high availability and load-balancing.
    - Use any web servers like Apache in front of weblogic servers.
    Using the above things you can also use customized HTTP Error Responses with error-page element in web.xml and create your own error pages which can be re-directed for the web server side also. For more information go through the below links
    Topic: Customizing HTTP Error Responses
    http://download.oracle.com/docs/cd/E13222_01/wls/docs92/webapp/configurejsp.html#wp157884
    Topic: error-page
    http://download.oracle.com/docs/cd/E13222_01/wls/docs81/webapp/web_xml.html#1017571
    Topic: ErrorPage
    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/plugins/plugin_params.html#wp1155425
    Hope above information helps you.
    Regards,
    Ravish

  • I have updated to the latest version of iTunes (11.2.2.3). However, when I connect my iPod it shows in My Computer and iTunes opens automatically when the iPod is connected but the device doesn't show in iTunes.  Any ideas?

    I have updated to the latest version of iTunes (11.2.2.3). However, when I connect my iPod it shows in My Computer and iTunes opens automatically when the iPod is connected but the device doesn't show in iTunes.  Any ideas?  I am on Windows 8.1 and my iPod is a Classic

    Hi murr18140,
    Welcome to the Support Communities!  The article below will help you troubleshoot the issue you are having with your iPod classic not being recognized in iTunes for Windows:
    iPod: Appears in Windows but not in iTunes
    http://support.apple.com/kb/TS1363?viewlocale=en_US
    I hope this information helps ....
    - Judy

  • Imovie has Idvd in the share drop down but i can't find it

    movie has Idvd in the share drop down but i can't find it

    Hi
    If this is a brand New Mac - Then iDVD is not included.
    Read -
    https://discussions.apple.com/thread/3402428?tstart=0
    Yours Bengt W

  • My mac wont turn on. It is charging and the on light is on when the computer is shut but once I open it the light turns off and the screen is black.  I turn it off and then on again and the start up noise goes but it is still black - Help!?

    My mac wont turn on. It is charging and the on light is on when the computer is shut but once I open it the light turns off and the screen is black.  I turn it off and then on again and the start up noise goes but it is still black - Help!?

    Claire, please post your machine specs as requested. There are some variants of the MBP with specific hardware issues. Example: the older "silver key" MBPs with 2.2Ghz and faster processors can have a defective video chipset that produces a black screen or distorted video. That problem is covered under an Apple program that will fix this at no cost to you if you computer is that model.
    Do "About this Mac" from your Apple menu and, in the resulting window, click the "More Info..." button. That launches System Profiler for you. The first screen looks like this:
    The second line, "Model Identifier" (or "Machine Model" if you are running OS10.4) precisely identifies your MBP variant. Post that, and include it in your equipment info in your profile for future posts. That means people don't have to ask, and you get faster help that is targeted to your specific model. Saves everybody a bunch of keystrokes and you get better advice.

  • When I try to start Lightroom CC i get the following error and the splash screen freezes An error occurred when attempting to change modules.

    When I try to start Lightroom CC i get the following error and the splash screen freezes An error occurred when attempting to change modules.

    Just had the same issue... went through the steps here: https://helpx.adobe.com/lightroom/kb/error-changing-modules-lightroom.html
    For me it was Solution 5. I had to change permissions and add me as a user (only had system access to the folders).

  • My MacBook pro shuts down when the battery drops down to 85% charge

    I have a 15inch MacBook Pro Model 1.1. When i run it on battery it always shuts down when the battery gets down to 85%. Does anyone know how to take care of this problem so that i can use the battery for longer?
    thanks!
    r

    Thanks, you're a life saver. Here is the report:
    AC Power:
    System Sleep Timer (Minutes): 10
    Disk Sleep Timer (Minutes): 10
    Display Sleep Timer (Minutes): 10
    Automatic Restart On Power Loss: No
    Wake On AC Change: No
    Wake On Clamshell Open: Yes
    Wake On LAN: Yes
    Display Sleep Uses Dim: Yes
    Battery Power:
    System Sleep Timer (Minutes): 10
    Disk Sleep Timer (Minutes): 180
    Display Sleep Timer (Minutes): 2
    Wake On AC Change: No
    Wake On Clamshell Open: Yes
    Display Sleep Uses Dim: Yes
    Reduce Brightness: Yes
    Battery Information:
    Battery Installed: Yes
    First low level warning: No
    Full Charge Capacity (mAh): 3004
    Remaining Capacity (mAh): 2994
    Amperage (mA): 0
    Voltage (mV): 12385
    Cycle Count: 41
    AC Charger Information:
    Connected: Yes
    Charging: No
    Hardware Configuration:
    UPS Installed: No

  • How can I create a scrolling effect where when the user scrolls down the image will blur out?

    How can I create a scrolling effect where when the user scrolls down the image will blur out?

    Hi there,
    You can create a scroll motion where the image will fade out on scrolling, you need to use the Opacity tab under Scroll Effects Panel.
    If you particularly need the image to be blur out, then you need to edit that image in any image editing program and make one copy of that image as blurred, then place both images (actual and blurred) on that page and use scroll motion or fade option to replace images.

Maybe you are looking for