[CS3] Simple Kids Drag and Drop Game? Maybe some re ordering too?
Ok Using CS3 Flash...
Hey Guys,
I am wondering about creating a simple 'kids' type of game.
I am thinking a simple drag and drop game
something like this:
Have a scene with say 4 different images (ex. dog, cat, etc..etc)
at the bottom have either the words ex. 'dog', 'cat' etc..etc or an image that goes with each image (ex. dog-dog bone, cat-fish, bird-nest etc..)
Each one needs to be able to be dragged and dropped to the correct image.
When they are correct, they can then advance to the next 'scene' of images and do it again.
**I am thinking of having it so everytime it is played the 'images' have changed to a new position or are in a different order-instead of always being the same, maybe have the words also change in the order at the bottom each time it is played.
Is there a simple way to do this?
I have some other style drag and drop games that work great....when they drag to the WRONG spot, it palys a 'sound' and snaps back to its original place. when they drag to a proper spot it plays another sound.
I really want to know how to make this so they reorder them selves each time to a different spot in that scene..(ex. have them all 4 images in a row, but next time have the order of the row change)
PLease....if anyone has any ideas on some simple code for this let me know.
Thanks..
Last edited by EvilKnevil; 11-28-2008 at 04:21 PM.
Um, you where here since 2001, and don't know this simple stuff?
...
anyway, to drag an object, you use
PHP Code:
startDrag(targetMovieClip);
...
to stop the drag, you use
PHP Code:
stopDrag()
...
Now, to see if the piece is placed on the correct place, you could have a movie clip, showing the region where the piece can be dropped, and which has an alpha value of 0 so it is fully transparent.
So you basically could do this:
PHP Code:
function checkPlacement() { if (dogMC.hitTest(_root.targetOfDogMc) == true) { trace("Yep, it worked"); } else { trace("No, wrong place"); } }
^Oh, ok.
Sorry if you felt insulted. I didn't mean to.
Would it be possible for you to post the current *.fla file, or make a mock-up file with bad graphics (in case you fear people might steal them)?
Or do you just want the pseudo-code function?
I would (Ive just done this exact thing in a game) create an array of your movie clips, so say you have your top clips are test1Top, test2Top etc etc
and then shuffle that array (google as3 shuffle to find one of a million out there)
then you can use your shuffled array and put them on the screen.
"I wouldn't know where to start to make that AS for an array, or how to place it."
has scared off a lot of people replying, because FK pretty much explained how to do it.
Arrays are a basic core principles of coding, if you don't understand them, then either:
* Someone is going to have to explain them to you ( The lack of response so far shows how popular that is )
* You're going to have to read up on them yourself.
'fraid your options are either give yourself a crash course in arrays and then ask more specific questions when you've got a handle on it better, or hunt for an open source game you can skin up / pay someone to do it.
Not exactly a wealth of information. You have 5,350 posts and that is your bit of assistance to someone's post on a matter pertaining to Flash coding??
I have searched on Google, I have searched many places actually..nothing I have found matches my particular senario---hence the reason I have come to FK to get some sort of direction on how to start this coding.
That is actually what FK is for I thought? If not, there is alot of 'people' who do not understand the core principles of coding, as you say that are wasting FK valuable time.
I wouldn't say anything has scared people off.
FK is FULL of people who don't have the answers to their FK problems, that is the reason that people come to FK to get answers from professionals and people who may be willing to assist.
Anyways...I appreciate any information I get. So, people may not have the answer to my solution....so I move on and keep looking. Please don't tell me though that I have "scared people off" and that "FK pretty much explained how to do it"..
By "FK" I meant the user, rather than the board / site itself as a whole.
"You have 5,350 posts and that is your bit of assistance to someone's post on a matter pertaining to Flash coding??"
Even if I had 5 posts it would still be my view. Your knowledge doesn't seem to be at a high enough level ( This isn't a criticism, it's an observation ) for you to be able to follow the advice already given to you, not just by me, but by FlashKit [ The person ].
"I wouldn't say anything has scared people off. "
Well... no one else has jumped in with a solution have they ?
Because... it'll mean either having to code it for you, or explaining arrays to you.
Now the theory is, as has already been said, you create an array with all the movieclips in ( array.push() ) and then shuffle that array ( http://www.sephiroth.it/proto_detail.php?id=149 first hit on google ) and then you loop through the array again, positioning the movieclips as they come out, eg
var mc:MovieClip=yourShuffledArray[0];
mc._x=firstXposition;
mc._y=firstYposition;
And so on until you've looped through the entire array.