playMaker

Author Topic: Playmaker "Match" style game  (Read 2438 times)

Crableg

  • Playmaker Newbie
  • *
  • Posts: 8
Playmaker "Match" style game
« on: May 25, 2016, 10:29:52 AM »
Just looking for some direction on how I would do this in playmaker, I am new to playmaker but loving it so far. So this is what I would like to accomplish:

Lets say a square, a triangle and a circle spawn on a wall, and you then need to choose from the UI a square, triangle and a circle out of a selection of shapes in the right order, how would you check whether you have placed the correct shapes ?

My logic at the moment in prototyping it is to assign each shape a tag like "square, circle etc" and basically check with a bool if the tag of the spawned shape on the wall is the same as the tag of the shape placed down by you.

Would this be a correct way to go about this? As I am still learning playmaker actions, is there a simpler way?

Thanks!

ergin

  • Junior Playmaker
  • **
  • Posts: 86
Re: Playmaker "Match" style game
« Reply #1 on: May 25, 2016, 11:10:44 PM »
Lets assume your shapes are A-B-C. to place shapes to a wall you have to know their order. I would randomise a string like ABC, CBA, AAC and when a button is pressed from the UI, I would compare if the user is picking the right Chars by using get Getsubstring. And at every pick I would increase Getsubstring index by one. I would also use Prefabs for shapes on the wall and use CreateObject to spawn them on wall and destroy to remove.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker "Match" style game
« Reply #2 on: May 26, 2016, 02:50:14 AM »
Hi,

 Checking by tag is a good idea and simple enough. I would go down that route happily myself.

 when you'll get more expert with PlayMaker, you'll find you could have your shape prefabs featuring an fsm hosting variables defining the shape, and from other fsm you could query them and find out everything about the shape being selected, dropped on or dragged.

you'll find that with tag you can only have 1 information, in your descriptiong this is fine, but what if you start to have more complex game logic, for example, a shape and a color, then tag won't be enough or at last become a bit clumsy to work with.

So go for tags right now, and be aware that along the way you may need to refactor this and implement something a bit more rich if more properties is needed to define a particular shape.

Bye,

 Jean


Crableg

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Playmaker "Match" style game
« Reply #3 on: May 26, 2016, 03:45:13 AM »
Hi,

 Checking by tag is a good idea and simple enough. I would go down that route happily myself.

 when you'll get more expert with PlayMaker, you'll find you could have your shape prefabs featuring an fsm hosting variables defining the shape, and from other fsm you could query them and find out everything about the shape being selected, dropped on or dragged.

you'll find that with tag you can only have 1 information, in your descriptiong this is fine, but what if you start to have more complex game logic, for example, a shape and a color, then tag won't be enough or at last become a bit clumsy to work with.

So go for tags right now, and be aware that along the way you may need to refactor this and implement something a bit more rich if more properties is needed to define a particular shape.

Bye,

 Jean

Lets assume your shapes are A-B-C. to place shapes to a wall you have to know their order. I would randomise a string like ABC, CBA, AAC and when a button is pressed from the UI, I would compare if the user is picking the right Chars by using get Getsubstring. And at every pick I would increase Getsubstring index by one. I would also use Prefabs for shapes on the wall and use CreateObject to spawn them on wall and destroy to remove.

Thanks for your responses!

Basically where i am at now is on start 3 random shapes are chosen from prefabs and placed in 3 set positions, i have that working fine, next step is for me to place down shapes in the same position, and for it to check that i have placed them in the right order. I will try out the tag method first cause there is only one parameter i need to check.

I think my biggest hurdle will be making a selection menu that you scroll through to select the shape, will have a look around at some GUI tutorials.