Tennis Scoring???

mcguansa24mcguansa24 Member Posts: 2
edited November -1 in Working with GS (Mac)
I am making a game and I would like to have tennis scoring. (Love, 15, 30, 40, Game) I am planning on doing a 2 out of 3 game thing. Does anyone have any idea how to go about coding that??

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    You could start by applying the scoring to a number.

    Each point gained increases the player's score by one.

    E.g.

    if player1score = 0 change attribute TennisScore1 to 'love'
    if player1score = 1 change attribute TennisScore1 to '15'
    if player1score = 2 change attribute TennisScore1 to '30'
    if player1score = 3 change attribute TennisScore1 to '40'
    if player1score = 4 change attribute TennisScore1 to 'Game'

    You would display the attribute TennisScore1 only, not player1score

    TennisScore1 should be a text variable

    You would do the same as above for player 2 - keep his score in the attribute player2score, and his tennisScore in TennisScore2

    To work out the 'deuce' and 'advantage' rules, you'd do something like:

    If player1score = 3
    AND
    if player2score = 3

    TennisScore1 = deuce
    TennisScore2 = deuce

    I'll let you figure out the rest yourself ;)

    Hope that helps!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • mcguansa24mcguansa24 Member Posts: 2
    Thanks a lot!
Sign In or Register to comment.