playMaker

Author Topic: GameObjectCompare problem [SOLVED]  (Read 1723 times)

tiqlat

  • Playmaker Newbie
  • *
  • Posts: 8
GameObjectCompare problem [SOLVED]
« on: May 11, 2014, 03:52:03 AM »
I`m making a memory game. Its like some cards with some pictures on them. There two cats, two dogs and etc. All by two pictures. We click on cards then cards rotate 180 degree and we see the picture on card. And then we click on second card and second card rotates 180 degree too. THen if they are identical cards they need to destroy themselves and if they are not they need to turn back again.
THis is how i tried to do it. First i put there mouse pick action to choose the cards with my mouse. And store it as FirstCard gameobject variable. THen mousepick event to this object and on mouse down it rotates 180 degree to us. Then the same process for the second card and i store it as SecondGame object variable. THen i put logic ``game object compare`` cos i need to check if first card variable and second card variable is identical or not.  If they are identical event should send to the state destroy object first card and second cart. If they are not identical action sends event to rotate them back again. But when i play the game the result is always not identical. They always turn back again even if they identical. Can you help me with this problem please?
« Last Edit: May 16, 2014, 10:46:36 PM by Alex Chouls »

1982

  • Junior Playmaker
  • **
  • Posts: 71
Re: GameObjectCompare problem
« Reply #1 on: May 11, 2014, 03:59:32 AM »
Gameobject compare does not work here, as two different gameobject are always different even with same name and other properties. There are many ways how to achieve what you want,

-give these gameobjects same name, and then use "Get name" action and "String compare"

-put a FSM to these cards, and define Int variable that has same value in both cards. Then use "Int compare".

There might be more ways too, I probably would use the naming solution.

tiqlat

  • Playmaker Newbie
  • *
  • Posts: 8
Re: GameObjectCompare problem
« Reply #2 on: May 11, 2014, 04:20:31 AM »
Thanks man. You saved me.