Need Help: Making a Lap Timer

CLV25CLV25 Member Posts: 36
edited November -1 in Working with GS (Mac)
Hi, i am making a racing game and I would like to have a lap timer in the top left corner that says what the current lap time is, what your best lap time was and what the previous lap time was. If only part of this can be done in game salad please tell me how to do so, thank you.

Comments

  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    Create a integer game attribute called bestlap
    Create a integer game attribute called laptime
    Create a Boolean game attribute called Goal

    ---------------------------------------------

    Make new actor called laptime
    put in a display text behavior
    chose game.laptime

    Put in a timer rule saying
    every 1
    Change attribute game.laptime TO game.laptime+1

    Put actor in a visible area
    ---------------------------------------

    Make a new actor called bestlap
    put in a display text behavior
    chose game.bestlap

    Create rule: ALL
    IF attribute game.goal is true
    IF attribute game.bestlap is < game.laptime

    Change attribute
    Game.bestlap TO Game.laptime

    Put actor in a visible area
    ----------------------------------------------------------------

    Create a new actor called Goal line. make it transparent.
    Place that actor on your goal line ;) so the timer knows when you cross the goal line.

    Create rule:ALL
    IF goal line collides or overlaps with "car"
    and Attribute game.goal is false

    Change attribute game.bestlap TO game.laptime
    Change attribute game.goal TO true

    --------------------------------------------------------

    On your Car:

    Create rule:
    IF car collides or overlaps with goal line

    Change attribute game.laptime TO 0
  • CLV25CLV25 Member Posts: 36
    thanks for the guide, it worked.
    However my car does not move anymore and i have tried changing the controls and using another car.
  • CLV25CLV25 Member Posts: 36
    also i am having problems with what you mean with 'put in a display text behavior
    chose game.laptime'
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    1.
    the reason why car is not moving could be that you put the rule
    "If car collides overlaps with goal" in the same rule as your navigation rules.

    You need separate them by creating a new rule to it in.

    2.

    open your laptime actor
    Drag in behavior - Display text
    in the display behavior, press the expression icon "e"
    select. Game, then laptime

    You do the exact same with the bestlap actor
  • CLV25CLV25 Member Posts: 36
    thanks i have done that but i still cannot get the best lap feature to work :O
Sign In or Register to comment.