playMaker

Author Topic: Rotate a cube  (Read 13570 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Rotate a cube
« 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?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotate a cube
« Reply #1 on: October 08, 2013, 02:51:52 AM »
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

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #2 on: October 08, 2013, 03:44:26 PM »
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?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotate a cube
« Reply #3 on: October 09, 2013, 01:29:20 AM »
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

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #4 on: October 09, 2013, 11:23:50 PM »
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. :-)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotate a cube
« Reply #5 on: October 10, 2013, 03:25:36 AM »
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

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #6 on: October 12, 2013, 09:53:58 AM »
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. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #7 on: October 13, 2013, 05:15:40 AM »
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! :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3985
  • Official Playmaker Support
    • LinkedIn
Re: Rotate a cube
« Reply #8 on: October 13, 2013, 07:55:00 AM »
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...

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Rotate a cube
« Reply #9 on: October 13, 2013, 10:10:56 AM »
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.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #10 on: October 13, 2013, 02:18:00 PM »
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! :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Rotate a cube
« Reply #11 on: October 13, 2013, 07:07:20 PM »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #12 on: October 13, 2013, 10:41:46 PM »
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?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Rotate a cube
« Reply #13 on: October 14, 2013, 07:39:48 AM »
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.
« Last Edit: October 14, 2013, 07:42:07 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Rotate a cube
« Reply #14 on: October 14, 2013, 08:35:42 AM »
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. :-)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no