playMaker

Author Topic: All objects collected > Next event - Noobish question [SOLVED]  (Read 1653 times)

LuukArts

  • Playmaker Newbie
  • *
  • Posts: 8
All objects collected > Next event - Noobish question [SOLVED]
« on: November 22, 2017, 11:06:44 AM »
Hello all,

I'm new to Playmaker and Unity in general and I'm stuck with a project that needs the following to be done:

Let's say we have a cube, a cillinder and a sphere in a world, if you succeed to collect all of these objects you will go to the next phase.


I've searched for tutorials etc. for this, but not with succes.

My question: How do I make a player go to the next phase only when he collected all objects?

I've found something about arrays, but it's still a bit confusing.

If anyone could help me or point to a tutorial, thanks in advance

Luuk

« Last Edit: November 23, 2017, 03:47:25 AM by djaydino »

Doh

  • Full Member
  • ***
  • Posts: 124
Re: All objects collected > Next event - Noobish question
« Reply #1 on: November 22, 2017, 11:31:43 AM »
I'd do this with two arrays, the first would be the required game objects, the second would be an array of the same length, though this time made up of bools. Have them all set to false to begin with, then have an FSM set the correct bool to true upon collection.

When you set the collection bool to true, make sure you first get the index number of the object on the game object array and tick the bool at the same index number of the bool array.

Hope that helps!

Doh

  • Full Member
  • ***
  • Posts: 124
Re: All objects collected > Next event - Noobish question
« Reply #2 on: November 22, 2017, 11:44:47 AM »
Forgot to add, each time one of the object from the array is picked up and the bool is set to true, I'd do a "Bool All True" check, if it passes then you can do whatever you want to alert other aspects of your game that the task is complete.

LuukArts

  • Playmaker Newbie
  • *
  • Posts: 8
Re: All objects collected > Next event - Noobish question
« Reply #3 on: November 22, 2017, 02:42:27 PM »
Nice!

I'll try this, thanks a lot!
Will keep this up to date if it worked :)


LuukArts

  • Playmaker Newbie
  • *
  • Posts: 8
Re: All objects collected > Next event - Noobish question
« Reply #4 on: November 23, 2017, 01:48:06 AM »
Worked like a charm!

Doh

  • Full Member
  • ***
  • Posts: 124
Re: All objects collected > Next event - Noobish question [SOLVED]
« Reply #5 on: November 23, 2017, 08:48:01 AM »
Awesome!  :)