From a10c798afd5f18301ce85f4ad9f2fac3393eb2d8 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 11 Nov 2014 14:24:49 +0100 Subject: [PATCH] Add comments and add/remove method to Credit class. --- .../spacescooter/gui/Credits.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/gui/Credits.java b/src/de/teamteamteam/spacescooter/gui/Credits.java index 930a580..92bd006 100644 --- a/src/de/teamteamteam/spacescooter/gui/Credits.java +++ b/src/de/teamteamteam/spacescooter/gui/Credits.java @@ -1,17 +1,47 @@ package de.teamteamteam.spacescooter.gui; +/** + * Static class accounting the credits a player earned during the game. + */ public class Credits { + /** * Credit points for the shop */ private static int credits = 1000; - + + + /** + * Private constructor. + */ + private Credits() { } + + + /** + * Get the current amount of credits. + */ public static int getCredits() { return credits; } + /** + * Set the current amount of credits. + */ public static void setCredits(int credits) { Credits.credits = credits; - System.out.println(credits); + } + + /** + * Add a number of credits to the credits account. + */ + public static void add(int credits) { + Credits.credits += credits; + } + + /** + * Remove a number of credits to the credits account. + */ + public static void remove(int credits) { + Credits.credits -= credits; } }