Keeping Score Richard Gesick.

Slides:



Advertisements
Similar presentations
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
Advertisements

Craps. /* * file : Craps.java * file : Craps.java * author: george j. grevera, ph.d. * author: george j. grevera, ph.d. * desc. : program to simulate.
Introduction to C# Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
UFCFSU-30-13D Technologies for the Web Creating and Using GUI Components.
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
Run time vs. Compile time
Microsoft Visual Source Safe 6.01 Microsoft Visual Source Safe (MVSS) Presented By: Rachel Espinoza.
Understanding class definitions Looking inside classes.
The switch statement: an N-way selection statement.
COMP1321 Digital Infrastructure Richard Henson February 2012.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
SE 320 – Introduction to Game Development Lecture 8: Animations, GUIs, Debugging and IDEs Lecturer: Gazihan Alankuş Please look at the last two slides.
CSC204 – Programming I Lecture 4 August 28, 2002.
Bank Reconciliation Process
CMSC 150 CONDITIONAL EXECUTION CS 150: Mon 16 Jan 2012.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
1 DMSS Disaster Management System Simulation. 2 What is DMSS? A single player simulation that allows the user to control emergency services, in order.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
A Casino Simulator Program Using Advanced C++ Concepts Thomas H. Hand July 25 th, 2005 Software/Hardware Integration.
Unity GUI Creating and Using GUI Components. Agenda GUI Components GUI Layout Using Styles and Skins for Design ‘Look and Feel’ Scripting GUI Communication.
Final Project Proposal Space Invaders By Jordan Mahaffey.
May 30-31, 2012 HDF5 Workshop at PSI May Metadata Journaling Dana Robinson The HDF Group Efficient Use of HDF5 With High Data Rate X-Ray Detectors.
New Game New Game Main Screen Resume Game Achievement s Achievement s.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
 2000 Prentice Hall, Inc. All rights reserved Introduction Divide and conquer –Construct a program from smaller pieces or components –Each piece.
Lab 2. Prepare: 1.Create a folder named lab2 inside the workspace. 2.Download RecordDB.java and Record.java from the lab document. 3.Change the file name.
ITM 3521 ITM 352 Functions. ITM 3522 Functions  A function is a named block of code (i.e. within {}'s) that performs a specific set of statements  It.
Lecture 18 File I/O Richard Gesick. File Input / Output Consider that a program may want to make its data persistent (or not rely upon the user for input)
Digital Game Design ACST 3710 Your First Unity Program 1.
Save and Load Systems Richard Gesick.
Game Settings Richard Gesick.
More on Functions (Part 2)
Lecture 2 Richard Gesick
How to access your work from home or another computer
Baseball Season Spring of 2008.
Character Selection from a lobby in Unity
Engineering Innovation Center
The winner is the first player to reach 20 points
Register Use Policy Conventions
SharePoint Workflow Master Class
Topics Introduction to File Input and Output
The Game: Attack and Defend
Licensing information
Chapter 10 Algorithms.
Computer Vocabulary Desktop
The winner is the first player to reach 20 points
More on Functions (Part 2)
Player preferences, Loading Scenes, Activating and Enabling
Week 6: Time and triggers!
Adding Integers with Different Signs
Introduction to Unity 2D Game Development
Lecture 16 File I/O Richard Gesick.
Fundaments of Game Design
Fundaments of Game Design
Fundaments of Game Design
Fundaments of Game Design
File Management System Simulation
Jason's Jeopardy Template
Agenda Warmup Lesson 1.9 (random #s, Boolean variables, etc)
Unity Game Development
Jason's Jeopardy Template
Topics Introduction to File Input and Output
Preference Activity class
Agenda Warmup Lesson 1.9 (random #s, Boolean variables, etc)
WHEEL OF WINNING WHEEL OF WINNING WHEEL OF WINNING WHEEL OF WINNING WHEEL OF WINNING WHEEL OF WINNING WHEEL OF WINNING WHEEL.
Online Pogo Game Customer Service
Pogo Game Customer Care Helpline Number

Call Pogo Contact Phone Number and Enjoy Pogo Game
Presentation transcript:

Keeping Score Richard Gesick

Objectives Create stats for the player Implement those stats in our scripts Create a stat tracker for the stats Create an achievement system Use PlayerPrefs to save our stats Use GUI methods to show the stats and achievements Create/assign the stats

Possible Stats Kills Deaths Total gold Current gold Gold spent Level Rounds won Rounds lost Kill-death ratio Win-lose ratio Time played Naming convention: pKills, pDeaths, etc Script necessary?

PlayerPrefs Allow storage of small amounts of info (strings, ints, floats) (about 1 MB total) Save data using: PlayerPrefs.SetFloat(“keyname”,variable name); Load data into game using: int pKills=PlayerPrefs.GetInt(“playerKills”);

StatTracker Script Methods to initialize, reset, update the stats during the game. Methods to set/reset PlayerPrefs for storage between games Display methods and later to read/write files

Setting Specific Stats void SetStat(string stat, int intValue = 0) //see opt code { switch(stat) case "Kills": pKills+= intValue; float fKills = pKills; float fDeaths = pDeaths; if(fKills != 0) pKDR = fDeaths / fKills; break; case "Deaths": pDeaths+= intValue;

Resetting Stats void ResetStats() { pKills = 0; pDeaths = 0; … }

Resetting PlayerPref void ResetAllPrefs() { PlayerPrefs.SetInt("PlayerKills", 0); PlayerPrefs.SetInt("PlayerDeaths", 0); PlayerPrefs.SetInt("PlayerTotalGold", 0); … PlayerPrefs.Save(); }

PlayerPrefs.Save() From unity documentation: Writes all modified preferences to disk. By default Unity writes preferences to disk during OnApplicationQuit(). In cases when the game crashes or otherwise prematurely exits, you might want to write the PlayerPrefs at sensible 'checkpoints' in your game. This function will write to disk potentially causing a small hiccup, therefore it is not recommended to call during actual gameplay. Note: There is no need to call this function manually inside OnApplicationQuit().

Saving the player prefs void SaveAllPrefs() { PlayerPrefs.SetInt("PlayerKills", pKills); PlayerPrefs.SetInt("PlayerDeaths", pDeaths); PlayerPrefs.SetInt("PlayerTotalGold", pTotalGold); … PlayerPrefs.Save(); }

Displaying stats void OnGUI() { if(showStats) statsRect = GUI.Window(0, statsRect, StatsGUI, "Stats"); } void StatsGUI(int ID) GUILayout.BeginArea(new Rect(15, 25, 400, 400)); GUILayout.BeginVertical(); GUILayout.Label("Level - " + pLevel); GUILayout.Label("Gold - " + pCurrentGold); …