Attach multiple behaviors to a sprite?

Hi I'm sort of a newbie to the Director and Lingo, and I was wondering can I attach multiple behaviors to a sprite

When I did, it moves only sprites

I want sprites first edit members, for animation

Then I want them to move in different directions, so having distinct behaviors

Here is my code:

THIS BEHAVIOR CHANGES THE MEMBER FOR THE ANIMATION AND WORKS FINE WHEN ATTACHED TO SPRITES:

Global

on beginSprite me

gvSprite = (me.spriteNum)

end

on exitFrame me

If sprite (gvSprite) .member = member("2") then

Sprite (gvSprite) .member = member("3")

else if sprite (gvSprite) .member = member("3") then

Sprite (gvSprite) .member = member("2")

end if

end

(1) THIS BEHAVIOR IS ATTACHED TO THE SPRITES I WANT TO MOVE LEFT

global gvSprite

on exitFrame me

moveLeft

end

(2) THIS IS ATTACHED TO SPRITES I WANT TO MOVE TO THE RIGHT

global gvSprite

on exitFrame me

moveRight

end

(3) THIS IS ATTACHED TO SPRITES I WANT TO MOVE LEFT

global gvSprite

on exitFrame me

moveLeft

end

(4) IT IS THE MOVE SCRIPT

global gvSprite

on moveRight me

Sprite (gvSprite) .locH = sprite (gvSprite) .locH + 5

end

on moveLeft me

Sprite (gvSprite) .locV = sprite (gvSprite) .locV - 5

end

When I tied 1 and 2 or 1 and 3 to a sprite, one of them moves

all solutions?

THIS BEHAVIOR CHANGES THE MEMBER FOR THE ANIMATION AND WORKS FINE WHEN ATTACHED TO SPRITES:

Global

on beginSprite me

gvSprite = (me.spriteNum)

end

on exitFrame me

If sprite (gvSprite) .member = member("2") then

I'm guessing that the line that begins "global" continues with "gvSprite". If Yes, then you set only a sprite as gvSprite: the sprite who most recently received a #beginSprite event.

Try changing this "property gvSprite" (and you'd like to replace all occurrences of gvSprite to pvSprite, where 'p' means 'property'.

(4) IT IS THE MOVE SCRIPT

global gvSprite

on moveRight me

Sprite (gvSprite) .locH = sprite (gvSprite) .locH + 5

end

on moveLeft me

Sprite (gvSprite) .locV = sprite (gvSprite) .locV - 5

end

Behaviors need not help of film scripts. You can put all the code inside the behavior.

Type this in your Message window:

See the film 'http://nonlinear.openspark.com/tips/sprites/2behaviors.dir'.

-What are you trying to do?

Note that I used only two behaviors. When you drop the behavior of displacement on a sprite, it asks if you want the sprite to move to the left or to the right. I also used a list of members for the behaviour of members of change, it will be easy to add new members to the list. I set the rate of 2 frames per second, so that you have time to see everything that happens.

Does that help?

Tags: Director

Similar Questions

  • Is it possible to attach multiple files to a contact in the address book?

    I stopped using WinPIM for our small business when I paid for the sync option and it has stopped working. Because the devs don't understand much English, I could never solve this problem. I discovered on Thunderbird and go to calendar/address book/email program.

    The only thing missing to make it a PIM for business, it's that you should be able to attach multiple files to a contact. Currently, I am using the photo upload to join estimate/job a customer. But if the customer calls for additional work or in the case of entrepreneurs, we must be able to set each worksheet in contact with the contractor.

    A way to do this?

    UPDATE: I think I found a way to do it. I can reach the estimate for the event file created for the appointment. However, I have a problem because the Windows Photo Viewer is not an .exe file and Thunderbird allows you to choose an application program to associate to open the attachment. I tried to find Windows Media Center, but it does not under Program Files or Program Files x 86, even though I know that it is installed on my Windows 7 laptop, as it appears as an option for default programs for images.

    I'd appreciate any help I can find a way to open these without having to use Adobe Photoshop (my only other option).

    Picassa is a program to look at a picture. So yes, I have ideas, the install if you have something to select.

  • Cannot attach multiple photos to send

    attach multiple photos to send

    Hello

    You can easily join several files to your email. Generally, all e-mail services provide this facility. But if you are unable to do so, then you can also try to zip together all your photos into a single file compressed using programs such as WinZip or WinRar and then attach the compressed file to your email.

    1. Download WinRar from this link: http://download.cnet.com/WinRAR-32-bit/3000-2250_4-10007677.html
    2. Copy all your photos in one folder.
    3. This folder using WinRar then zip
    4. Attach the compressed file.
  • attach multiple documents

    How can I join multiple pdf had documents to your e-mail, rather than having to send them individually?

    If you use attach to e-mail button in Acrobat or Adobe Reader, you can only attach the specific email PDF. You can not join other PDF files.

    If you want to join multiple PDF files, you must do with your email application.

  • Spawning multiple instances of a sprite (shoot the balls).  Need help.

    Hello.  I am currently doing a game in director 11.5 for a University project.  I decided to make a scrolling space shooter, but I encountered a problem.  A tutorial I found has created a limited 'Bank' of the balls of fire, allowing only a number on the stage at one point.  What I have to do is to let a single sprite ball off the edge of the page and copy essentially he and behaviours lingo to spawn another instance of the ball on the scene when the player fires (using the left button of the mouse in this case).  I also need this copy should be deleted entirely when it collides with an enemy or leaves the boundaries of the stage, otherwise the game will just run more slowly and more slow several shots are taken.

    I heard that it is possible using the puppetSprite() method, but the API is not shine much light on the issue and no a literally hours of searching on google.  If anyone can let me know any method to do so, I would be very grateful.

    On a related, when matter fired the bullet will need to intsect the situation where the mouse cursor was when the bullet was fired and then continue on a linear trajectory.  I worked on a method to do this, but it's not very effective or efficient (the speed of the balls would be determined by the cursor of the mouse is how far from the ship of players and I think that there is probably a less intensive calculation method to achieve) and as I can't spawn bullets from now I really don't know if it will work yet.  If anyone has any advice on how to best implement this mechanic, even once, I'd appreciate your comments.  Thanks in advance.

    -start-up of the main script, movie named "main script.

    on startMovie

    _movie.idleHandlerPeriod = 0

    end

    on mouseDown

    Bullet = script ("ball script") .new)

    end

    -end of movie script
    -start of the script of the frame, frame script named 'script-framework '.
    on exitFrame me
    go part
    end
    -end of the frame script
    -beginning of the script of the ball, parent of script named "ball script."
    bulletSp property
    minY property
    pObjTimer property
    the new me
    -create sprite
    -find an empty channel from the channel in the foreground
    CNT = _movie.channel.count
    Repeat with i = cnt until 1
    If sprite (i) .member = (member 0 castLib 0) then
    -make sprite
    bulletSp = channel (i) .makeScriptedSprite (member ("bullet"), _mouse.mouseLoc)
    bulletSp.scriptInstanceList.add (me)
    minY =-(member("bullet").height)
    -start moving the ball
    pObjTimer = timeout () .new ('ball' & i, 3, #moveBullet, me)
    output of repetition
    end if
    end repeat
    return to me
    end
    on moveBullet me, _objTimer
    bulletSp.locV = bulletSp.locV - 1
    sendAllSprites (#collisionTest, me)
    If bulletSp.locV<= miny="" then="">
    me. Destroy()
    end if
    end
    to destroy me
    pObjTimer.forget)
    Channel (bulletSp.spriteNum) .removeScriptedSprite)
    end
    -end of the script of the ball
    -beginning of the collision test script, script behavior called "script of collision."
    on collisionTest me, _spOrg
    If sprite (_spOrg.spriteNum) .intersects (sprite (me.spriteNum)) then
    sendSprite (_spOrg.spriteNum, #destroy)
    end if
    end
    -end of the collision test script
    1 paste the script 'major' in one of the film's script and give it the same name.
    2. double-click on frame 1 in the script to frame channel and past the image inside script.
    3. create a new script, assign a Parent script in the property inspector and stick the ball in there script. Name it "script of ball."
    4. create a new script, assign a script of behavior in the property inspector and passed the test of collision inside script. Name it "script of collision."
    5. create an image of the ball and make sure the registration point is defined to be at the high point of the ball. Name the image of Member 'ball '.
    6 Create rectangle shapes to the top of the screen, and then drag and drop the script "collision" on them.
    7 press the Play button and move the mouse around the scene while clicking the left button of the mouse to shoot bullets. The balls will be destroyed when they reach the top of the scene or when they hit a rectangle.
    8 study scripts. If you need the commented code, or a more complete explanation/walk-through of what happens in the code then let me know and I'll give it.
  • Can I attach multiple external monitors to my Pavillion dv7 laptop?

    I have a monitor connected via the HDMI interface, and I would like to have another one is attached as well. Can I use the VGA port (either a dish - I don't kjnow not what it's called) and have the instructors work together?

    Thank you!

    -Jerry

    (Windows Vista, Pavillion dv7 laptop computer)

    Hello, Jerry:

    Theoretically, you should be able to connect monitors as you have video ports.

    As I don't have your model, I can only speculate.

    I know that's true for desktop (where the embedded video is handicapped by an add on card).

    In my view, that the other HDMI-looking port is a display port.

    Paul

  • Attach multiple batteries on a desktop and a user

    I'm testing App Volumes 2.9 and 6.2 of the Horizon, and I have a pile with all default applications that our users would get (java, flash, Adobe Reader, Chrome, etc.). I had some problems with Chrome crashing when I joined it via the username, so I decided to attach it to the computers OU Office were in and everything worked great since. However, now if I join another pile of user-specific application, it never gets home. I tried to restart, redial, etc. But if I attach it to the computer, it works. Once I attach a pile of application to a computer that I lose the ability to attach another user? If so, I feel that I will return to a deployment type Thinapp which I wanted to get away from. Any idea would be appreciated... Thank you!

    Hello

    It is not possible to attach appstacks for user objects and computer.

    Maybe in the next version, I hope.

  • Attach multiple files to email through donkey

    Hello. I'm trying to improve My donkey and add several attachments to the e-mail message.

    This is my last try: gist: 1fcc08159e4cb724bbf2

    Problem in the present code:

    if(filesPaths!=""){
       String[] filesPathsArray = filesPaths.split(",");
       ArrayList<Uri> uris = new ArrayList<Uri>();
       for (String filePath:filesPathsArray) {
          Uri uri = Uri.parse("file://" + filePath);
          uris.add(uri);
       }
       emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
    }
    


    I get the message 'could not attach files.


    But I know that my table is correct. When I try to add a single file, it works fine:


    emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filesPathsArray [0]));

    What I am doing wrong? How to fix join them several files?

    Ok. I realized how to solve the problem.

    Necessary to use Intent.ACTION_SEND_MULTIPLE instead of Intent.ACTION_SEND.

  • problem of multiple behaviors

    I am new to web design, here is the problem. I have an image to swap in a field, this behavior causes another behavior in another area of the page. It works fine (after a lot of troubleshooting!), but now I can't link to the next page. I created this in a template, when I saw in the browser from the template, the link works, but if I navigate to the homepage and THEN try to access the linked page mentioned above, the link does not work. Any suggestion? I'm not very good with HTML, but I'll post below for the button. Any help would be appreciated!

    I found the problem! Laughing out loud. It of just that I had created my buttons and accidentally made an editable region. I don't know why, but its makeup links not carry to other pages. It's no wonder that it has worked in my template page. Thanks a lot for your help!

  • Cannot attach multiple images in hotmail

    I have the same problem with Windows 7. It blocks the program used to ataching muliple photos

    Hello brendav,

    For problems with Hotmail, please ask your question in the forum after using Windows Live.
    http://windowslivehelp.com/product.aspx?ProductID=1

    They will be better placed to answer your question in Hotmail.

    Sincerely,.

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • FW CS4 has the notion of multiple behaviors "sequential"?

    I have an image with a top access point. I want a picture of a window when the user clicks on it. Now here's the tricky part... I want to click on it again and have another picture of a window to appear next to it. It would go like this:

    Click only once... see picture 1
    Click new... image 2 appears next to the picture 1

    I am trying to simulate a button that can be pressed several times and each time it has activated another window will appear.

    Thanks for any help.

    jcbluesman wrote:
    > I have an image with a top access point. I want a picture of a window
    > When clicked. Now here's the tricky part... I want to click on it again and
    > see another image of a window beside it. It would go like this:
    >
    > Click once... see picture 1
    > Click... image 2 appears next to the picture 1

    It cannot be done in Fireworks.

    --
    Linda Rathgeber - Adobe Community Expert
    http://www.Adobe.com/communities/experts/members/8.html
    --------------------------------------------------------------

  • reversal and color change

    Hello
    I would like to change the color of text when the mouse is over, and when the mouse is passed, it should return to normal. Is this possible? I found the behaivor of 'member of working capital change' and used two identical texts with different colors, but can't make it work. What is the right way? Thanks for the help! /Emma

    You could attach a behavior to the sprite on the stage like this. It would change the text to red when the mouse is over the sprite.

    Mmtp property
    pColor property
    pColorOver property

    on beginSprite me
    Mmtp = sprite (me.spriteNum) .member
    pColor = pMem.color
    pColorOver = rgb (255,0,0)
    end
    on mouseEnter me
    pMem.color = pColorOver
    end
    on mouseLeave me
    pMem.color = pColor
    end

  • Several virtual machines attached to port VM group

    Hi all

    So I did research on the internet and on this forum and I have not found a good answer to my question. So I would check that I can create a unique Virtual Machine port group and attach multiple virtual machines and run them simultaneously. I basically want to have each VM attached to this switch, but instead to a separate port group, it seems that I can just attach to the same port group that puts on the vSwitch.

    Is there problems of L2 with MAC address or ARPing or something like that? I realize that I have to ensure that each VM has correctly configured the IP settings. I know there are problems, but I am wanting clarification of the people who have done this before. Are there problems of interface as with a real switch speed or who is not serious in a vSwitch?

    Thank you!

    -GNS

    You can attach multiple virtual machines to the same group of port without problems, this is how normally environment are created. Have a look here for more details: vSphere Standard switches

    The image below shows several virtual machines connected to the same port group:

  • He had to set multiple RDM on a virtual machine

    Hello geek,

    I'm writing a powercli script that attach multiple RDMs to a virtual machine. I google and a lot of scripts I received yet, but it's not obvious.

    I thought to create the csv file containing all the canonical of the RDM and importer names that helps import-CSV, then no idea how to go further.

    New drive hard cmdlet will join but how to attach multiple of RDM?

    Please answer

    Thank you

    Asif

    The UseCulture switch takes care of different separator characters that exist in different locales (locale).

    Get-Help Import-Csv-parameter UseCulture

    The character '%' is an alias for the ForEach-Object cmdlet.

    You can check by doing a

    Get-Alias %

    The Get-Help and Get-Alias cmdlets are very useful when you use PowerShell.

    Another useful is the Get-Member cmdlet, which displays the properties and methods on an object.

    Get-VM-name MyVM | Get-Member

  • Email with multiple attachments using ADF Mobile

    Hello

    I want to send multiple attachments using ADF Mobile, using Jdeveloper version 11.1.2.3.0

    looking at the signature of the method below sendEmail(), attachments param looks as String

    DeviceManagerFactory.getDeviceManager (.sendEmail)
    java.lang.String to
    java.lang.String cc
    java.lang.String subject
    java.lang.String body
    java.lang.String bcc
    spare java.lang.String
    java.lang.String mimeTypes)

    Is multiple attachments supported in the ADF Mobile? If so, please suggest how to achieve this scenario.

    -Deepak

    Deepak,

    You can attach multiple files as string separated by commas (paths).

    Ex: http://technology.amis.nl/2012/12/27/adf-mobile-device-interaction-api-pictures-gps-and-email-with-attachments/

    Ref: http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/amxbinding.htm

    Arun-

Maybe you are looking for