Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE DIRECTOR: HomeDirector ForumTagMotion Graphics

Re: Lingo to match two clicked on sprites - like a matching game

Cow Forums : Adobe Director
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Re: Lingo to match two clicked on sprites - like a matching game
by William McGrath on Feb 11, 2009 at 5:40:43 pm

>>Would the script for each pair of sprites be considered a movie script?

No, it's a behavior. Don't use movie scripts for this particular thing. To change from one to the other, click on the information icon.

>>Do I have to make a different script for each pair of sprites?
Yes, there are ways of doing it all in one single script, but the programming can be a lot more involved. Basically this way you'll be duplicating the same script several times, and just changing the name of the script and the value of the property.

>>Can this script apply to letters that are from a different langauge?

Yes, because what you're assigning as a value for the property is a string in quotation marks. I don't think it should give you any problems.

>>Are the values for gClick1 and gClick 2 set in each global?
They are just two globals all the time. What changes is the value. That's the difference between the global variables and the properties (every script has it's own myLetter property independent from all the rest. But gClick1 and 2 are just two variables, the same two for all the sprites.

>>How do I write the globals for gClick1 and gClick2?

Put this line at the very top:
global gClick1, gClick2

Now, when you function with those names in any part of the script, Lingo knows that you're referring to global (and not local) variables.


>>For the comparison part of the script do I need to use the whateverElse option? I was going to write as follows:

if gClick1=gClick2 then
play "correct"
else play "incorrect"
end if
<<<

Yes, I think that should work nicely

Well, else and then a new line for play "incorrect"

>>What do I reset these values to or do I leave them as they are?
gClick1=""
gClick2=""

Once you've compared them, reset them to "", yes. Otherwise, the next time you click on something, the value of the first variable will still be carried over from the previous time (remember it's a GLOBAL variable). So it could never work as it should. The idea is: the first time you click, it knows it should modify the value of the first variable, and the second time it should work with the second time. How? With the first click it looks at the first variable and says: ¿is this taken? No=OK, then this is the first click. Yes=OK, then it's the second click.



---
william


Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]