Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rabagast on May 21, 2015, 04:12:36 PM

Title: ArrayMaker help
Post by: Rabagast on May 21, 2015, 04:12:36 PM
Hi!

I finally start to understand ArrayMaker. And it's really cool.
But I need some help. I post a video of my example.

I can try to explain what I'm trying to do.
The game will be a toy game. As you can see in the video, is it 3 boxes with an image on it. It picks randomly 3 images from an Arraylist. And also the falling toys will be the same images as on the boxes. You need to get all the toys in the right boxes, so you need to click on the falling toys to change it so it match the image on the box in that column.

This is my question:
How can I do this, so I can click on the falling toys and change it to another toy?

I would be very grateful for some help here. :)


https://youtu.be/2vru8zpuicQ (https://youtu.be/2vru8zpuicQ)
Title: Re: ArrayMaker help
Post by: sebaslive on May 21, 2015, 04:32:00 PM
Have the boxes identify the object falling in by its tag. you have three tags, bearToy, dragonToy, elephantToy.

Have an fsm that lets you click on the toy object and when the player clicks on the object it sends an event to the next state which changes the sprite and the tag from bear sprite and tag to dragon sprite and tag. Etc...

You can also set it so that you have an Int variable on the object. 1 - Bear, 2 - Dragon, 3 - elephant. Every time you click it changes to the next int and you have another fsm that compares the ints and if 1,2 or 3 it changes the sprite to the corresponding int. Then you can have the box grab the int from the toy and check to see if it is the right int.

That should do it!
Title: Re: ArrayMaker help
Post by: Rabagast on May 21, 2015, 04:39:40 PM
Hi!
Thanks! I will try. Should I have a mouse click action on each toy, then?
Title: Re: ArrayMaker help
Post by: Rabagast on May 21, 2015, 04:55:05 PM
Another problems is that I already have these toys tagged as "TOYS", so I can't tag them like you said. But I tried to make a Mouse Action on one of the prefab toys and then send an event to a FSM in the scene where I have an Array List Get Next. And then I create a new toy from the Game Object I stored in Array List Get Next, but it doesn't work as I want. It create the next toy in the list, but the spawn point is wrong.
Title: Re: ArrayMaker help
Post by: sebaslive on May 21, 2015, 05:18:34 PM
In the second example I put you don't need to use tags since it is getting the information from the Int Variable being 1,2 or 3.
Title: Re: ArrayMaker help
Post by: Rabagast on May 21, 2015, 05:33:14 PM
Ok. Should I use create object every time I click on the toy? And then delete the previous one?
Title: Re: ArrayMaker help
Post by: sebaslive on May 22, 2015, 07:16:05 AM
Using get set property you can change the sprite of your object to change into the other one.