playMaker

Author Topic: Beginner's question  (Read 1904 times)

kiikooo

  • Playmaker Newbie
  • *
  • Posts: 3
Beginner's question
« on: July 26, 2014, 10:39:42 AM »
Hey guys,

Im new here so hello to you all.

I need help with something I'm sure is fairly simple but I'm having a problem with the logic.

So i am trying to select a game object and compare it to another(these are any random objects). After i select the first item, I want to select any random object and compare the two values.

Whats the best way to go on about doing that?

Thank you :)

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: Beginner's question
« Reply #1 on: July 26, 2014, 11:10:37 AM »
Hi kiikooo!

There are a few ways of doing this, depending on what you need.

One way of doing it is by having these objects share a Tag and then create an FSM that will randomly select these objects based on that Tag. You can use the "Get Random Object" Action. You can run this event twice on the FSM - get one object and store it as obj1 and get another and store it as obj2 and then call the values you want from these (then use a "Float Compare" for example).

Hope that helps
« Last Edit: July 26, 2014, 12:36:24 PM by MajorIdea »

kiikooo

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Beginner's question
« Reply #2 on: July 26, 2014, 03:43:36 PM »
Hi MajorIdea,

Thank you for your reply.

Hmm, yeah that kind of makes sense.

Lets say its a card memory game. So ill have 20 cards on screen. Select the first one (have it flip or whatever) then select the other one to see if they match.
Is tags the way to go in this situation?

Thanks

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: Beginner's question
« Reply #3 on: July 27, 2014, 06:32:14 AM »
I'm sure there are more ways of doing this but how about you:

1- Assign a Float value to a card - (SetFloatValue) (maybe if it's a four of spades you could number the card suit and say spades is number 3, so the number you would assign that card would be 43)

2- get the two cards randomly like I mentioned before and use a GetFsmFloat to get the number

3- then just use a FloatCompare and if the numbers are equal you send a corresponding event.

That should work  ;)

kiikooo

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Beginner's question
« Reply #4 on: July 27, 2014, 10:05:25 AM »
This is what i started to do. I used an int instead of a float though.(Don't know if that is bad practice)

I'm just a little confused with it being random. Why am i getting the cards randomly since what i need are the values of the cards i am selecting?