IN-DEPTH POST #5 – PROGRAMMING FOR VIDEO GAMES

In-depth Post #5 – Programming For Video Games

Justin C

Some Questions I will be answering

What kinds of learning opportunities does the mentor provide to expose you to new learning?

What kinds of learning opportunities exist to reinforce new learning?

What kinds of opportunities exist that might accelerate learning?

When you get together what do you talk about?

What is going particularly well in your mentoring relationship right now?

What are you learning about one another?

My mentor Conor exposes me to new learning by providing sources I can learn new skills from. This was a YouTube playlist that my mentor recommended to me at the beginning of my project: https://youtube.com/playlist?list=PLFt_AvWsXl0fnA91TcmkRyhhixX9CO3Lw. It helped me to understand and learn the functions and features of using the Unity Game Engine. With Programming, the best way for me to reinforce my learning is through practice, by creating my own projects. By creating my own projects, I’m exposed to new ways to use my skills. By gaining more experience, I can work faster and more efficiently on future projects. A method for accelerating my learning is through online tutorials via videos and articles. There are lots of free sources that show me new tips about Programming with C#. These videos teach me about the common mistakes beginners make, ways I can further my learning and different techniques for different functions. Online sources have helped me to grow my learning at a faster rate. When my mentor and I meet, we talk about my progress since our last meeting. I show my mentor what I’ve been working on, and my mentor provides feedback on my work, suggesting ways I could improve my code or change it to be more efficient. We talk about new features of my game that I’ll be working on with my mentor as he provides guidance on how to progress. As well, when learning something new in Unity, such as an “enum”, my mentor gives me an overview of it and teaches me some important tips she knows through screen sharing on Zoom. I learned that an enum (also called enumeration) is a user-defined value type used to represent a list of named integer constants. My mentoring relationship has been going overall very well. My mentor provides good relevant suggestions and feedback on my work, and he answers my questions very well. Lately, my mentor has been helping me brainstorm features I can implement into my game. Throughout the project, we’ve always stayed updated with each other about my progress, and our meeting schedules. I send him emails about my progress with any questions I have when needed, and that’s been working great so far. Something I’m learning about my mentor is what he’s experienced. He has a lot of valuable experience in Programming and using the Unity Game Engine, but in some areas, specifically the basic starting codes he takes time to remember as he doesn’t use them as much in his day-to-day life. However, he has still provided valuable information and has taught me almost everything I know. I think something my mentor is learning from me is what types of features and game ideas I want to implement into my game. So far, I’ve really been enjoying experimenting with different power-ups and modifying different values in my game.

Programming my Game:

What I learned since my last post:

  • Enumerators
    • The first new concept I learned was Enumerators or Enums for short. An enum is a user-defined value type used to represent a list of named integer constants
    • Ex.
      • enum WeekDays { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };

rather than making a variable for each day, for example below.

      • float WeekDays Monday;
      • float WeekDays Tuesday;
      • float WeekDays Wednesday;
      • float WeekDays Thursday;
      • float WeekDays Friday;
      • float WeekDays Saturday;
      • float WeekDays Sunday;
  • Health system 
    • UI For health bar 
      • For this, I created a simple User Interface of two horizontal rectangles in which the front one shrunk when damage was taken and grew when the player healed using a Healthpack. The front rectangle was green as it symbolizes life and the background rectangle is dark red symbolizing death when you fully lose all of your health.
    • Healthpacks 
  • Damage system with lava and the void 
    • I created two different damage systems regarding taking damage from lava or from falling into the void.
  • Object-oriented programming using the same code to code two different objects 
  • Created a coin collection system which was then turned into a general collection system to collect the Healthpacks, Coins, and Speed Powerups.

Code for Collecting items and each boost:

Increase player speed (perm and set duration) (two different ones) 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Collect : MonoBehaviour
{
public float pointvalue;
public enum Type
{
coin,healthpack,speedboost
}
public Type type;

private void OnTriggerEnter2D(Collider2D col)
{
switch(type)

  • Prefabs in Unity
    • Unity’s Prefab system allows you to create, configure, and store a GameObject complete with all its components, property values, and child GameObjects as a reusable Asset. The Prefab Asset acts as a template from which you can create new Prefab instances in the Scene. When you want to reuse a GameObject configured in a particular way, like a non-player character (NPC), prop (in my case Coins, Speed Powerups, and Healthpacks) or piece of scenery in multiple places in your Scene, or across multiple Scenes in your Project, you should convert it to a Prefab. This is better than simply copying and pasting the GameObject because the Prefab system allows you to automatically keep all the copies in sync.

Leave a Reply

Your email address will not be published. Required fields are marked *