playMaker

Author Topic: ArrayMaker : Checkpoint system[SOLVED]  (Read 5079 times)

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
ArrayMaker : Checkpoint system[SOLVED]
« on: October 28, 2012, 10:04:31 PM »
I'm having some trouble figuring out how to build a checkpoint system using ArrayMaker

I've searched the forums and can't find anything.

Could someone either explain how it works or build me an example?

Thanks
« Last Edit: November 05, 2012, 11:18:49 AM by MrMitch »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker : Checkpoint system
« Reply #1 on: October 29, 2012, 01:47:23 AM »
hi,

 Can you describe what you mean by check point? is it theoritical check point, waypoints? how do you define these way points?

bye,

 Jean

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: ArrayMaker : Checkpoint system
« Reply #2 on: October 29, 2012, 06:06:25 AM »
Hi Jean,

Sorry i should have explained myself a little better.

The game is a 2D Platformer.

I'm looking for a way to store several different predefined positions(checkpoints) that the player is spawned at when they die, they start at the first position(checkpoint) then when they manage to get so far through the level they 'activate' the second position(checkpoint) so they are spawned further into the level when they die.

I thought this could probably be done using triggers but i'm just unsure of how to use ArrayMaker to make it work.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker : Checkpoint system
« Reply #3 on: October 29, 2012, 06:27:54 AM »
Hi,

 ok, I see now. I think you don't need arrayMaker for this. what you need is a simply maintaining a player pref of the last check point gameObject name or reference.

if you name your waypoints like "check point 1", "check point 2" etc etc then you can simply "find" the next check point for example.

 if you want to use arrayMaker, then simply host your waypoints in order, as the user trigger a check point, adda reference to this arrayList.

the issue with arrayMaker in this case is that it's not serializable, so you do need to maintain a direct reference to the last checked point so that when the user comes back to your game you know where he should start. If this system only works during play time, then arrayMaker is of course fine.

Does that explains a bit more? if you need a working example, let me know, this is easily achievable.

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker : Checkpoint system
« Reply #4 on: October 31, 2012, 06:45:33 AM »
Hi,

 Ok, here we go, a working example of a CheckPoint system done with ArrayMaker. ArrayMaker is not mandatory here, but it does ease the process and workflow dramatically, else you would need to do some hardcoding on CheckPoint GameObject names and have a lot more states and actions to check on the current situation. Here with ArrayMaker, you simply define the list of CheckPoints during editing ( or at runtime, that's up to you) and managing them becomes easier.

One thing to note and be very careful with: Since CheckPoints are also spawning points, when the scene starts, the very First CheckPoint would mess the routine, therefore its collider is disabled. First because it's anyway unnecessary in all cases, and two because if it was not, it would trigger before the CheckPoint Manager has time to check for a previous Game in the playerPrefs.

Have a look at this sample, it's not very complicated. One thing to improve on from there, is to isolate CheckPoints Physics collider to only account for the player, you can do so by defining a layer for CheckPoints and in the physics Settings only allow CheckPoints layer to watch out for the player layer. You can do so manually as well, this is up to you.


bye,

 Jean

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: ArrayMaker : Checkpoint system
« Reply #5 on: November 04, 2012, 02:59:27 PM »
Thanks Jean

I got it working with my project, i have one question though, how can i make it so that the player object doesn't keep its momentum when it's moved to its new position?
« Last Edit: November 04, 2012, 03:03:40 PM by MrMitch »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker : Checkpoint system
« Reply #6 on: November 05, 2012, 12:31:12 AM »
Hi,

 you mean using my implementation or your player controllers?

 In my implementation, you would simply leave the state where you check for input and come back to it with a timer or waiting for a new input from the user.

 With your controller, it depends on what you use, and it would certainly be a matter of pausing the scripts or fsm responsible for movement input.

 Does that help? else, can you precise what controller you are using for your player?

bye,

 JEan

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: ArrayMaker : Checkpoint system
« Reply #7 on: November 05, 2012, 03:40:04 AM »
Hi Jean

Using your implementation.

For controlling my player object i've got a rigidbody on a sphere and it's moved by adding force.

I will take a look at your suggestion later on.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker : Checkpoint system
« Reply #8 on: November 05, 2012, 04:40:49 AM »
Hi,

 Then, simply set it to kinematic until a new user input or for a given laps of time.

bye,

 Jean

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: ArrayMaker : Checkpoint system
« Reply #9 on: November 05, 2012, 11:16:14 AM »
Thanks Jean

Don't know why i didn't think of kinematic but at least it's working :)