playMaker

Author Topic: Game over event for script  (Read 1886 times)

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
    • View Profile
Game over event for script
« on: February 19, 2016, 09:57:24 AM »
Hello guys,

for my game, i'm using playmaker and i create a script for the score.

i would like to know how can i call the "game over" event in playmaker so i can use it on my script as a boolean?

i code in java.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Game over event for script
« Reply #1 on: February 19, 2016, 10:37:55 AM »
If you want to access variables in a script try the "Get property" and "Set property" actions- just drag and drop the script into the actions field-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
    • View Profile
Re: Game over event for script
« Reply #2 on: February 19, 2016, 11:35:54 AM »
thank you for you reply,

i already use "game over event" with playmaker on my game and it works fine.

What i want to know is how can i call this event in my java script?


merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
    • View Profile
Re: Game over event for script
« Reply #4 on: February 20, 2016, 09:09:52 AM »
i'm completely lost...

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Game over event for script
« Reply #5 on: February 20, 2016, 09:54:18 PM »
Why not just build a score system in Playmaker? Then you won't have to deal with sending events to/from scripts-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Zeldag

  • Full Member
  • ***
  • Posts: 198
    • View Profile
Re: Game over event for script
« Reply #6 on: February 22, 2016, 10:39:11 AM »
I dont know scripting at all myself, but i think I know how it can be done. If you could set up a float (or int i think) variable to be the score in your script.

Then with the 'game over' fsm open, drag and drop the script component from the game object onto the state's action list. When you drop the script there select 'get property', in the small menu that appears.

In the 'get property' action's drop down menu, i think you should be able to choose the 'score' variable from the script (though ive never used get property on a script myself). Save the score variable from the script into a playmaker variable, every frame if thats an option.

Then add a float/int compare to compare the variable you just saved from the script...

When the score is 0 or less send to the game over state (or whatever numbers you have in mind).

Also you can reverse this using 'set property'. So to make a bool for the script, setup a bool in playmaker ( for example 'game over= true' once the score has reached 0) Drag and drop the script component from the game object, into the actions list on the game over state. Choose 'set property'. Then setup the action so the playmaker bool value sets the bool value in the script.

Hope my ramble helps lol. Let us know how you get on.
« Last Edit: February 22, 2016, 10:51:19 AM by Zeldag »