Introduction
The Year 13 Programming assessment requires that you also include 2 complex techniques.
You only need to pick two techniques from this list:
● programming or writing code for a graphical user interface (GUI)
● reading from, or writing to, files or other persistent storage
● object-oriented programming using class(es) and objects defined by the student
● using types defined by the student
● using third party or non-core API, library or framework
● using complex data structures (e.g. stacks, queues, trees).
You only need to pick two techniques from this list:
● programming or writing code for a graphical user interface (GUI)
● reading from, or writing to, files or other persistent storage
● object-oriented programming using class(es) and objects defined by the student
● using types defined by the student
● using third party or non-core API, library or framework
● using complex data structures (e.g. stacks, queues, trees).
Writing code for a graphical user interface
In year 12 you are required to create a program that Responds to events in a graphical user interface.
This means that the buttons etc already exist and you are writing code that responds lets say to a user clicking a button. In year 13 the GUI has to be programmed. When writing a video game you will be doing this by default. If you for example program health to appear and disappear then you will be meeting this criteria. |
Reading and/or writing to persistent storage.
In order to meet this complex technique, you would need to write to persistent storage or read from persistent storage.
There are two places when making a game where this would be easiest: a.) Writing a save file, that saves your game b.) Creating a Config file to save the settings for the game. i.e. A user adjusts the volume to 70%, next time it loads the volume gets set to 70%. Why is this important? To help improve the quality of the experience the user should be able to set settings to ensure a consistent experience. If you were doing an electronics project, you might have to use an EPRAM module to store data. |
Object orientated programming using classes and objects.
In year 12 you are required to use multidimensional lists. Which often means using objects within an array.
This year you may wish to use classes and objects. A good breakdown in unity is found here: https://www.studica.com/blog/unity-tutorial-classes/ Here is an example of a player class in unity. Please note you cannot use the default classes created by unity, but have to have user defined ones. public class Player { // Properties of the Player public string Name { get; private set; } public int Health { get; private set; } public int Score { get; private set; } // Constructor to initialize a new Player object public Player(string name, int health) { Name = name; Health = health; Score = 0; // Start with a score of 0 } // Method to deal damage to the player public void TakeDamage(int damage) { Health -= damage; Health = Mathf.Max(Health, 0); // Ensure health doesn't go below 0 Debug.Log($"{Name} took {damage} damage. Remaining health: {Health}"); } // Method to add score public void AddScore(int points) { Score += points; Debug.Log($"{Name} gained {points} points. Total score: {Score}"); } // Method to check if the player is alive public bool IsAlive() { return Health > 0; } } public class PlayerManager : MonoBehaviour { void Start() { // Create a new player Player player = new Player("Hero", 100); // Display player's status Debug.Log($"Player {player.Name} created with {player.Health} health."); // Simulate gameplay player.TakeDamage(30); player.AddScore(50); player.TakeDamage(80); // Check if the player is alive if (!player.IsAlive()) { Debug.Log($"{player.Name} has been defeated."); } } } |
Defining and using your own types.
When creating a game you may have use for creating your own types.
This is so we can define enemies/weapons/players with types so we can give them certain stats. A complex technique is to create your own types. public class Weapon { public string Name; // Name of the weapon public int Damage; // Damage dealt by the weapon public float Range; // Range of the weapon public WeaponType Type; // Type of the weapon (using an enum) // Constructor to initialize a weapon public Weapon(string name, int damage, float range, WeaponType type) { Name = name; Damage = damage; Range = range; Type = type; } public enum WeaponType { Melee, Ranged, Magic } |
Using Third Party or Non-Core API's, Library or Frameworks
Complex Data Structures
A complex data structure is a type of data structure that combines multiple elements or data types into a single unit, allowing for more sophisticated data organization.
An example would be a Dictionary of Lists as a complex data structure in Unity to organize inventory items in a game. This allows you to categorize items (e.g., Weapons, Potions, etc.) and store multiple items under each category. Example: Category: Weapons Item: Sword, Quantity: 1 Item: Bow, Quantity: 2 Category: Potions Item: Health Potion, Quantity: 5 Item: Mana Potion, Quantity: 3 You can |