Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rabagast on October 07, 2013, 04:28:06 PM
-
Hi!
I want to rotate a cube 180 degrees. It's easy to rotate, but how can I stop it?
-
Hi,
use the action "iTween Rotate to" action and it will stop at the rotation you specific within a given time lapts or speed.
bye,
Jean
-
Ok, thanks!
Can't I ask you for another thing?
I want to make a kind of memory game where I
need to find two identical pictures. But I have a
little problems. When I click on two pictures, and these
are not identical, the pictures will turn back after 3 sec.
I tried one thing, but the problem was, it was only one picture which
turned back.
Can you please help me a little?
-
Hi,
This is in your logic, you need to stop the itween and start another tweening. It seems to me you don't properly stop itweens.
now, if you want to send an event to several picture, you have to broadcast a global events so that all pictures can get it, and the ones that are flipped can flip back.
bye,
Jean
-
Ok!
Now I can turn the card. And It can also turn it back, but my problem is when the two pictures are not identical. I don't know how I can turn them back again. I have tried to think and think and think. I think I need to compare these two pictures in a way. I don't know!
Is it possible to get a little bit more help? This was worst than I first thought. :-)
-
Hi,
Ok, I just did the other day a very similar example.
http://hutonggames.com/playmakerforum/index.php?topic=5120.0
simply replace dragging with clicks, and cubes scales instead of rotates, but the spirit if the same, so if you understand the concepts applied on that example, then you'll be able to flip your card properly.
Bye,
Jean
-
Hi!
Nice example. I think is very difficult to figure out how I will change it to what i'm looking for. Because I'm learning more to do everything by myself.
I hope it's an easer way to do my example. :)
-
Hi, again!
The only thing I want to do is very simple!
Now I just use colors. I will change it to pictures later.
I want to know how I can tell Playmaker when two cards matches to each other or not. If I turn a green and blue card, they don't matches and will turn back in 2 sec.
If it's matches! Two green or two blue, they will stay.
I was thinking maybe every cards could have it's own Int variables. For example green could have 1, blue could have 2, etc. But the problem is that the Int variables need to be set only if two colors matches. I'm stuck with that.
Can someone help me? jeanfabre?
Thanks! :)
-
You could use tags. Tag the blue card with a Blue tag, red card with a Red tag etc. Then compare tags to see if they're the same...
-
Are you making a match 3 game or something?
Flying Robot made a Match 3 kit. It's pretty complicated, but if you're just trying to make 3 cubes, or just a few things match up then you can do something like Alex is suggesting since its pretty easy to change tags and compare 3 object tags.
-
Hi!
I tried to use tags, and it's working in a way. I just need to figure out how I can make a pause. For example when I turn two cards, which is not matching, then I need a pause so I can't click on other cards before the two cards turns back again.
Lane: It's a memory game where I need to find two matching cards.
It's a challenging from my brother. He is a programmer! And have made a memory game to Android. "Memoria" is the name.
I said that I could make the same game with Playmaker, so now I need to prove that. :)
So if I could get some help, I would be very happy! :)
-
Here is a match two example.
http://hutonggames.com/playmakerforum/index.php?topic=4025.msg24656#msg24656
-
Thank you very much, Lane! :)
Just have a question. If I want to add more cubes with different colors, how can I do that? I tried to add one with yellow, but maybe I need to do some changes in the FSM?
-
The way I have it setup..
Add more matchables/cubes/slots
This is driven by the children of the PlayArea object, create new objects and move them where you want. The FSM will then count the children and loop through a spawning state that creates the actual playing cubes at the positions of those spots until it runs out of children.
Add a new tile type
Make a new prefab and change the child's color and name. When cloning objects the names of the parent are changed but the children do not so I just made a child object, painted it a color and named it that color. The FSM will get the child, store its name, then compare the two for a match of the name when you pick them. So as long as you have a prefab that has ONE child with a name, this will work. The FSM chooses which ones to create randomly, so just go to the spawning state and add the new prefab to the random object list.
This would work great by Tag's too, but I didn't want to add new tags and then they not get sent over in the package so this works okay as well. You could easily change this to grab & compare tags and it would be a lot cleaner.
-
Thank you! :)
Is it possible with this setup to only have two matching cards in one game?
For example, I have 3 X 3 board. And I want to only have two blue, two yellow, two red, etc. As it is now I can end up with two differents colors on the last two cards.
I will try to figure it by myself in the meantime. :-)
-
Yeah I had thought about that, but only had about an hour to put this together.
It could be resolved several ways.. maybe by counting the spawn points, dividing by how many different tile types/cube types you have being placed, then creating that number of each type in sequence to make sure there are the same number of each. You would do best to setup a board that has an evenly dividable number based on how many cubes you have, to make things simple.
There are other ways as well. We're basically making a world-space array system, so it may be better to just move on with Arraymaker after you get the general idea of how it can work from this example.
-
I have never used Arraymaker before.
What about to just have two of each cards and you just place them randomly in the PlayAreaSpots?
As it is now, It create a random object of the prefabs and place it in the spot.
So if I have two blue, two green, two yellow, etc. And in the start of the game, in the Start State, I make them appear randomly at the spots, if you know what I mean?
-
I think if there are a static number of slots, yeah.
I preferred to count the spots, divide them up, then create the game tiles so you can make a play area of any size by placing more spots and not need to change the Game FSM. Better for long-term.
-
Are you going to make that when you have time? Sounds so difficult for me. :)
-
Give it a whirl, study the example and see what you can accomplish. You'll be stuck forever unless you learn these how these things can be done and apply that knowledge on your own. :) 3 months ago this would have been impossible for me to do, now its fairly straightforward because I took the time to practice and learn.
If you're still stuck on it after a few days I'll modify it and you can compare the examples.
-
Yes, you're right. I will see what I can do. I need to study it. And change things to see what's happening. Thank you for helping. :)
-
I'm a little bit stuck with these random thing.
First I tried the easest way. To just have two of each card, and put them at the spot randomly. But the problem was that it could happened that two cards could appear at the same spot.
You don't need to solve it for me. Just give me some ideas I can try. :)
-
Have you changed any other variables?
It counts the children of the PlayArea object, then stores that count and repeats the spawn object loop and each time gets the next child, so technically that shouldn't happen. If that is the problem area you might try putting a Next Frame Event in the loop just in case. Often times it goes too fast (i guess) and weird things happen.
If you went to two object only then you should have just had to change only the create object action to use 2 slots instead of 3. The whole system should have still worked after that.
-
I just tried to delete the first states until the state Idle. Just to see if I could make my own random system. So I didn't change any variables.
So I can maybe change something in the FSM so it's only two matching cards on the board at the same time? This was more difficult than I thought. I know how to make one cube random.
-
Ha! Yeah it's certainly not trivial =)
The approach I took and thought process:
- Create a "Play Area" Game Object
- Create the "Spot" game objects that I would make Game Tiles would spawn at.
- Store the Spots as children of the Play Area
- Count the children objects of the Play Area, store that count in a variable. This is all of the possible spots that the Game Tiles can spawn, and the number of tiles I will have on the board during play.
- Use Get Next Child (of PlayArea) and use that as a spawn point for Create Random Game Object and list the available game tiles there.
- Subtract one from that count since we just spawned a Game Tile
- Loop this set of actions until....
- A String Compare action is checking to see if The Count variable has reached zero, meaning we're done filling the game board. If its zero, then go on and move into the next part of the game state
Hope that gets you going =)
-
Ok, thanks! I will give it a try tomorrow, Now it's sleeping time . :)
-
Hi!
Thank you! Now I'm understand what's happening, but I want only two of each color in the PlayArea. Two blue, two red, two yellow, etc. How can I do that?
-
Are you wanting a smaller board size? Just reduce the number of Spots in the PlayArea, and move them where you want the tiles to be spawned at. You could just move them to a different object or something as well.
It is a little more challenging to maintain an equal number and I'd have to look at it for a while to cook something up, likely the spawning system will have to be changed quite a bit. The computer needs to know how many of each tile to spawn, so that would be the available spawn points divided by the number of tile options.
Then it needs to know where to spawn them, if its in sequence then you can use Get Next Child to store the spawn point, if its random then you need Get Random Child and also have to destroy the Spot you just spawned into so that it doesn't randomly choose it twice on accident.
It also needs to know how many of each tile that it has created, so you can likely use the existing subtraction method, but have a separate integer for each tile type you are spawning.
You can do it though, its just a matter of thinking through it and experimenting =) Figure out what the computer needs to know and find a way to give it that information.
-
Hmmmm, sounds difficult. I will try to experiment a little.
Can you also try to figure it how to do it?
-
I found a little bug when I click on the first cube. It is possible to click on the same cube one more time after the first click. Then it will find two matching cubes.
I tried to set the layer to default when I'm clicking on it and then set it to water when it's finished and starting over again. But the problem was that it was just the first cube which was changing the layer to default and the second cube was changing back to water which was already water, so it doesn't work. Some ideas?
-
Btw. I started a new topic called Multi-random cube. So if you have so ideas how to do that I was asking about, just use the other topic. :)