playMaker

Author Topic: Marking the game distance  (Read 2654 times)

jongkook

  • Playmaker Newbie
  • *
  • Posts: 34
Marking the game distance
« on: April 09, 2014, 03:48:01 AM »
I am going to mark the distance on game screen as the game ‘Jetpack’.

Jetpack game : https://itunes.apple.com/us/app/jetpack-joyride/id457446957?mt=8

It takes a form to fix the characters but move only the background.
I pose this question because I tried to express the distance value based on time but had difficulties.

The below is c# code of a similar example;
------
 public void METERUPDATE ()
 {
          Meter += Time.deltaTime * GameSpeed;
          Meter_Label.text = string.Format ("{0:N0}<color=#ff3366> m</color>", Meter);
 }

------
How could I implement this with Playmaker?
« Last Edit: April 09, 2014, 01:42:38 PM by jongkook »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Marking the game distance
« Reply #1 on: April 09, 2014, 05:28:42 AM »
Create a state with a float add action and simple add the game speed per second.

jongkook

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Marking the game distance
« Reply #2 on: April 09, 2014, 10:24:20 AM »
I'm sorry.  I don't know how to do it.

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Marking the game distance
« Reply #3 on: April 09, 2014, 12:47:11 PM »
make an empty game object and call it game manager. Give it an FSM called Distance Traveled. On the start state add the action Float add. Make a variable called timer and make it a float.

In the action float add, set the variable as timer. set the add to 1 and check every frame and per second. Make another action called convert float to int and create a new int variable called realTimer. Set the float to timer and int to realTimer and rounding to Round Up.

Last we need to set this to a string to display. So another action called convert int to string. Create a new string variable and call it distance. Set the int to realTimer and the string to Distance. You can also set the format to 0000 so it starts with the 0's and counts up.

Use this string with whatever way you want to display it, ngui, 2dtoolkit, unity gui, etc. I would recommend going through all the playmaker tutorials that covers this and more!
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

jongkook

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Marking the game distance
« Reply #4 on: April 09, 2014, 01:42:18 PM »
Thanks sebaslive.
The problem has been fixed.