|
Post by brucewilli1 on Apr 26, 2016 16:30:50 GMT
Hallo everybody, i use hipp5 only for fun. Now i decided to update the Memory game at the Demos. But, my knowledge is to less. How can i learn more about the Scripting? At the moment i am searching to solve two Problems. How can i call objects when they only in the biliothek? is this generally possible? The second Problem: How to Shuffle objects, normaly used in an Array. Please be patient about my english. Im older than 50 years.
|
|
|
Post by runes on Apr 26, 2016 18:59:39 GMT
Welcome to the forum! Two very quick answers: It's impossible to call objects from the library. They have to be placed on stage and given a scriptId. Shuffling... ..You will have to put the scriptid's in an array (as you mention yourself) and make a sorting function. Something like: function randOrd(){ return Math.round(Math.random()-0.5); } ...then call the function when needed: yourArray.sort(randOrd); It sounds to me like you have some knowledge of Flash/actionscript. Am I right about that? Because that's really good basis for learning Hippani Animator. Study the forum and tutorials and you'll soon be a master
|
|
|
Post by brucewilli1 on Apr 27, 2016 11:54:59 GMT
Many thanks for the quick answer.
You are right, serval month before ich did a little with Actionsscript.
But, now my next question?
How can i put the cards at a certain position on the stage with script?
In Actionscript i used "eval" and the value of "_x" and "_y" to put it to a desired position.
Maybe i have to read the right book. Can you give me a suggestion?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 27, 2016 17:10:37 GMT
Step 1: how to change the position Let's say you have an object on main scene , you should check the "Use ScriptId" option to allow that object to be accessed through js. e.g we rename it to "target" , and now "target" can be used to do a lot of things such as target.X , target.Y , for available api , please see: www.hippani.com/?S=AnimatorHelp&Page=FrameStep 2: how to create objects through a shuffled array And now we have a list of objects , you may wish to create them dynamically . The hippani 5.0 provided you a new way that similar to action script 2.0 "attachMovie" called "DuplicateItem", so you can uncheck the visibility option of your "target" to false , and duplicate it through a shuffled array , and show them finally . Step 3: how to grab player's click action This is a little tricky if you really need to detect witch button or hotpots have been clicked in a shuffled list , at least so far no easy way. Please see here : hippani.proboards.com/thread/846/useful-functions-developersFinally: I would still recommend you to find other ways to do this if possible . And also your project should be keep as small as possible , because when project grows larger , you will need more time to solve more difficult problems.
|
|
|
Post by brucewilli1 on May 3, 2016 15:10:40 GMT
First of all, sorry about my late reply, and thank you for your answer. At the beginning of my memory-project i thougt it was a small project. In the attached file i show you the recent work. ... Later i will use Timelines (i hope so), now its a programm for the very young people Memory006.hani (920.28 KB) ... but again ... i need a little help form ....In Javascript i guess i can use the script as follows: K1a = document.getElementByID("Karte1a") // Karte1a is the ID at my stage and randomly sorted and then i want to add an listener to it K1a.addEventListener("click", myFunction, false); ... and nothing happend, or many errors occur. I´m keen on a little help -- thanks
|
|