Changing sprite depending on mouse location?

Hi
I'm trying to change a sprites member according to the
location of the mouse but so far can only get it to change once.
So far i've got:
on exitFrame me
if the mouseH < 0 then
sprite(8).member = member("cannon_test_30left")
end if
if the mouseH > 1 && the mouseH < 256 then
sprite(8).member = member("cannon_test_20left")
end if
if the mouseH > 257 && the mouseH < 384 then
sprite(8).member = member("cannon_test_10left")
end if
end
Any help would be appreciated as I can only get it to change
once when it goes passed horizontal position 384 and then says that
way.
Thanks

try putting
go the frame
right before the "end" so it loops on that frame.
hope that helps....
Timm
"jclegs" <[email protected]> wrote in
message
news:f0ls91$edg$[email protected]..
> Hi
>
> I'm trying to change a sprites member according to the
location of the
> mouse
> but so far can only get it to change once.
> So far i've got:
>
> on exitFrame me
>
> if the mouseH < 0 then
> sprite(8).member = member("cannon_test_30left")
> end if
>
> if the mouseH > 1 && the mouseH < 256 then
> sprite(8).member = member("cannon_test_20left")
> end if
>
> if the mouseH > 257 && the mouseH < 384
then
> sprite(8).member = member("cannon_test_10left")
> end if
>
> end
>
> Any help would be appreciated as I can only get it to
change once when it
> goes
> passed horizontal position 384 and then says that way.
> Thanks
>

Similar Messages

  • Move container sprite according to mouse movement

    Hi All,
    Currently I'm developing a game where there is a object which follows mouse. Also there are other objects and a map on the screen.I want all of background content(whole map and other objects) to move when user moves mouse left or right. That is, if user moves mouse on right side then all content(except object which moves as per mouse) should move left side so that user can see remaining part of map on the right side.
    As of now I have created new Container sprite in which I have added all of my objects and map. So when user moves the mouse right, I move the container sprite to left so it looks all stuff moves to left. Code looks like as below
    var pt:Point = new Point(character.x, character.y);
    pt = dori.localToGlobal(pt);
    if (pt.x > (stage.width * 0.5))
                        container.x -= 5;
    Structure of project is such that, I add Container directly to stage. and this container contains everything like map, character and other objects.
    Now issue is that as soon as mouse goes beyond middle of stage...it creates distance between mouse location and character..!! I mean it does move according to mouse but some distance get created between mouse and character. and this distance keeps increasing as I continue to move mouse away from center of stage!!
    I'm really stuck with this issue. Please someone help with this. I hope I have explained this well. Let me know if you need more info but please help.

    No see......I dont want ease in n all....and character following the mouse logic is working fine if I dont use above linear interpolation to move the container mc.....
    but I do want to move container mc as well so I will have to use what you gave to move the all background objects when user moves mouse....
    so Again to clarify, in the game when user moves mouse the character should follow and at the same time bakckground objects which are in container mc should move opposite to mouse movement so that remainng mape gets visible to the user....
    just now when I was debuggin the linear interpolation logic...I got to know that there something I need to change in it...because accroding to that logic...let say for example
    stageWidth is 480
    maze.width is 551
    then x1 will be  480
    y1 will be -71
    x2 will be 0 and
    y2 will be 0
    so m = (y1 - y2) / (x1 - x2) = -71 - 0 / 480 - 0
    m = -0.147
    b = y1 - m * x1 = -71 - (-0.147 * 480) = 0
    so on each enter frame when mouseX wil be multiplied with m....it will create lag in moving container(character is in container as well!
    bcoz
    container.x = m * stageRef.mouseX + b;
    so I'm confused!!
    where do u think shall correction be made??

  • How control can be customized so that it changes its picture when mouse moves over it

    How control can be customized so that it changes its picture when mouse moves over it. As it happens in other develpment enviroments that one can customized the look 'n feel of any thing during the mouse movement over that very thing. Moreover can any body plz tell me that how one can modify the funtionality of a control by him self (not selecting the available functionalities of controls and indicators)

    The attached LV 7.1 code uses an event configured to trigger on two controls when a "Mouse Enter" or a Mouse Leave" event occurs. Depending on the type key focus is either assigned or removed.
    Please elaborate on the Q re: customizing a control.
    Ben
    PS Do NOT change the boolean to an indicator, save, run, change to control, save run again. That is bad.
    Forgot to attachMessage Edited by Ben on 05-05-2005 09:30 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    MouseOver.vi ‏28 KB

  • Content translation depending on the location

    Hi
    I have got a requirement.When a user enters into the portal through internet, i want to change the entire content of the portal depending upon the location. And also the Portal Admin Should get the location of the entered user
    i.e; when a user enters from germany, the entire content of the portal should be displayed to him in German(without the user clicking any link).Here in this case the Portal Admin should get the location of the user as Germany.
    It would be very helpful to me, if anyone can throw some light on this
    Thanks in advance,
    Regards
    Rajeev.

    Hi
    As far as I am aware you can only do this through the locale, as opposed to the physical location, as this isn't part of the Http request. If you use the locale then you can use the standard portal translation functionality. By doing this you can change all of the PCD Objects so that they are translated to the relevant language. Also, when creating the content you could use the Java resource bundles, as you would then create a resource bundle for each language you would like to have displayed.
    I hope this helps a little
    D

  • Unable to change the LOV of To locator in Subinventory transfer form

    I am trying to change the LOV of To Locator field in the Subinventory form.
    I have made the trigger event as "When-new-form-instance"
    In actions tab:
    Built in : Create a record group from query and gave a name to the record group
    Property: LOV - ENABLE_LIST_LAMP - Group_name - <gave the name of the record group>
    But it gives an error : Cannot create the record group.
    The name of the column in the form for To Locator is : TRANSFER_LOCATOR and its defined at the item level.
    Can anyone please help?

    During the implementation of a recent project, we suffered from the same issue. There seems to be no way to recolor that part of a pivot table, but you can remove it by disabling the row header... which, in your case, should also remove the header "Class".
    The way I see it, the users would already know what that Class column is supposed to be about. So you don't actually need to have that header displayed, if you ask me.
    If someone has a proper solution to this question though, I'd be interested :)
    Cihan
    Edit: Spelling
    Edited by: cihanc on 14.Eki.2012 23:21

  • I just installed iTunes on my computer, where I already have all my music. I went to Edit Preferences Advanced, and changed the iTunes Media Folder Location to where I have all my music, in the "Local Disk." But iTunes wont import all my music. Help?

    I just installed iTunes on my computer, where I already have all my music. I went to Edit > Preferences > Advanced, and changed the iTunes Media Folder Location to where I have all my music, in the "Local Disk." But iTunes wont import all my music. Help?

    Have you looked in the Music App on your iPhone? On the iPhone music is played by the Music App not iTunes.

  • Changing the default bookmarks save location

    Heya,
    If i right-click a website and click "Bookmark this page". It brings up the bookmark panel with the default folder "Bookmarks Menu" is there any way i can change this default ?
    "I dont mind if it goes deep into the firefox:config, system or regedit as i am mostly computer savie :)"

    ''Changing the default bookmarks save location:''
    You would do better clicking on the bookmark star on the Location Bar.
    You can install "Add Bookmark Here2" and probably make modifications in the options.
    * Add Bookmark Here ² :: Add-ons for Firefox<br>https://addons.mozilla.org/en-US/firefox/addon/add-bookmark-here-2/
    * http://dmcritchie.mvps.org/firefox/addbookmarkhere2.txt

  • I have iphone 4s with iO6. My problem is I can no longer update my apps since "cannot connect to itunes" always shows on my screen when i try to. Tried fixing by changing the dates, turning off location as suggested in some forums but both didn't work!

    I have iphone 4s with iO6. My problem is I can no longer update my apps since "cannot connect to itunes store" always shows on my screen when i try to. Tried fixing by changing the dates, turning off location as suggested in some forums but both didn't work!  Please help!! Thanks.

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • Itunes cannot locate my files on the external hard drive - I changed preferences but still not locating songs?

    itunes cannot locate my files on the external hard drive - I changed preferences but still not locating songs?

    This work for the most part:
    https://discussions.apple.com/message/20361846#20361846

  • How do you change the Default 'Save As' location in Adobe Acrobat 9

    How do you change the Default 'Save As' location in Adobe Acrobat 9?

    You put a shortcut to the desired location in that location. You are then only 1 click away.

  • How to change the line item storage location during the sales order creatio

    How to change the line item storage location during the sales order creatio

    Hi Kumar,
    I think you can just delete it in the sales order directly, if you are using make-to-order scenario, then there will be special stock left for the sales order as the production has been goods receipt, you need to use MM transaction move the stock to unrestricted use stock. If you are using make-to-stock scenario, there should be no further problem. If you are using assembly order, please try to reject the sales order item to see if it could fullfill your requirement.
    Regards,
    Rachel

  • Does Mouse Locator work in Mavericks?

    Hi there,
    I have three displays attached to my Mac Pro... will soon be running Mavericks. 
    Sometimes my mouse cursor is hard to locate, and I'd love to go back to using a little app called Mouse Locator.  But I stopped using it a while back, after upgrading to Mountain Lion, and I'm leery of trying it with Mavericks... unless I hear from some users that it works.
    I've written more than once to the company that came up with this app (2POINTSFISH.COM), asking about compatibility, and they haven't responded.  Not a good sign!
    Has anyone been running this with Mavericks?
    Or running some other little app that will 'locate' your mouse cursor (Mouse Locator does it with a green circel) when you touch your mouse (the green circle then disappears).
    Regards,
    Malcolm

    Yes, I had the same issue in Mavericks and solved it by copying MouseLocatorAgent.app into the PreferencePanes Folder from another Mac where the reactivation at start-up still worked (hope you can still find this file on previous back-ups or older machines). Then I added MouseLocatorAgent.app to the Login Items in Users & Groups of the System Preferences. With this Mouse Locator starts when booting the Mac and I no longer need to click through the System Preferences to start Mouse Locator. Hope this works for you, too.

  • How to determine the text on a given Mouse Location

    Hi friends,
    Can you people guide me with this feature? I'm using JTextPane & want to determine the text on a given Mouse Location on Mouse Click event. I consulted the docs but could'nt make out any methods providing this feature.
    Thanx in advance.
    Afroze.

    Hi,
    I think you can use the viewToModel() method... it should do the trick.
    Regards.

  • On KeyUp change sprite and sound

    I made something in Flash and it works fine. Now I am trying
    to migrate it to Director.
    I need to have six sprites on the stage.. they are avi's and
    they loop. Each has a sound cast memebers associated with it. They
    are designed to run in synch.
    I would rather re do it from scratch in director thatn import
    the swf.But my lingo and understanding of Director is kinda almost
    zero.
    I can get the mouseUp to change a sprite but I need key board
    interactivity. And using key codes like (32) for spacebar etc
    I need to adapt this very basic instruction
    (The code is below)
    to this... onKeyDown change sprite "myClipOne" to member ==
    "myClipTwo"
    and there is because there is a Play Sound behaviour attached
    to the "myClipOne" sprite I also need this
    on the same onKeyDown event to swap the sound from
    "mySoundOne" to you guessed it "mySoundTwo"
    Each of the movie sprites will have a bunch of keys
    associated with it. And pressing keys just changes the avi and the
    sound for each movie on the stage. Simple really but I am stuck
    with it.
    I need to use Director for this project and would be most
    grateful for any help.
    Cheers

    Try something like:
    on keyUp me
    case _key.keyCode of
    32:
    sprite(1).member = member("myClipTwo")
    sound(1).play([#member: member("mySoundTwo")])
    36:
    sprite(2).member = ...
    sound(2).play([#member: member("...")])
    -- other key codes listed as required
    end case
    end

  • Change dock settings and mouse actions in accounts?

    After creating accounts for my class periods I changed the appearance of my/the administrator's dock and the actions of my mighty mouse to enable right click. After logging out and then logging back in as one of my class periods my changes did not carry through.
    Please tell me there is an easier way to change the dock and mouse actions than having to log back in as the administrator, going to EACH account, changing them so they can access system preferences, log back in as the class period, make the changes and finally go back in as the admin to take off their access to system preferences. Yuck...
    Also, when a student is logged into their period is there a way to switch to the admin account temporairily? For example, if they try to open an application they don't have privileges for shouldn't it prompt the admin to type in the password instead of requiring that I log out? Thanks for any help!

    Download and install the Server Admin Tools from Apple. It is intended for OS X Server but works fine on the regular version of Tiger.
    Then have a look at Workgroup Manager. It allows you to set all sorts of preferences for any number of accounts. Think of it like Parental Controls on steroids.

Maybe you are looking for