Game Dev Notes #3 – Quiz Game

These are notes from the Complete C# Unity Game Developer 2D Udemy Course

UI

Right click -> Create canvas

Any element that shows up on the canvas needs to be a child of the Canvas.

Canvases use Screen Space instead of game space. The camera takes care of world space, but screen space is something entirely different.

Some common things you’ll want to do:

  • Create an image as a child of the canvas. Right click the canvas and UI -> Image
  • Use the Rect Transform on the image to set its position. Hold down shift to change the anchor point, and alt to also set position. It’s good to hold both down at once. You can also stretch elements to full screen here.
  • Create a pre-visualization layer so you can see what you expect your UI to look like (that doesn’t actually do anything) and set it later.

Grid Layout

For things you need organized together, you can make them children of an object such as AnswerButtonGroup. From that empty object, you can add stuff like buttons and other menu items. Add a component called “Vertical/Horizontal Layout Group” and it will automatically organize the children for you.

Scriptable Objects

Change the class type to ScriptableObject when creating a new script, no start or step event needed.

[createAssetMenu( menuName = “Quiz Question”, fileName = “New Question” )] – lets you take the script you created and use it in the Unity UI by right clicking -> Add new -> [SO]

Getter Methods

  • Gives a script read-only access to a private variable
  • Protects the contents of a private variable
string question = "Enter new question text";    
public string GetQuestion()
    {
        return question;
    }

Lists

Like Arrays, but you can change their size.

Arrays:

Int [ ] oddNumbers = new int[5]

Methods:

array.length – return the length of array

Lists:

List<int> oddNumbers = new List<int>()

The first part declares the type of List we’re creating ( a list of ints ), stores it in a variable name and then creates a new list.

Methods:

List.Count – Return length of list.
Lust.Contains(3) – Check if item exists.
List.Add( 3 )- Add an item.
List.Remove(3) – Remove an item.
List.RemoveAt(0) – remove item at given index
List.Clear() – clear the list.

Things to Look Up

  • How do attributes work in Unity?
  • What is going on here?
    [Header("Scoring")]
    [SerializeField] TextMeshProUGUI scoreText;
    ScoreKeeper scoreKeeper;

    void Start()
    {
        timer = FindObjectOfType<Timer>();
        scoreKeeper = FindObjectOfType<ScoreKeeper>();
    }

ScoreKeeper is the class I created I think, but then later we assign it to the object that has the script attached to it?

  • I don’t understand why we add a TextMeshUI object, then add a separate ScoreKeeper object…
  • Why

Game Dev Notes #2 – Snowboarder

These are notes from the Complete C# Unity Game Developer 2D Udemy Course

Profiles

Unity comes with lots of existing packages that contain default profiles. We can override them by going to assets -> create -> 2D -> Sprite Shape Profile. Then we can click and drag onto the Profile section in the inspector. That will let us use the sprite profile we created instead.

When we create a new sprite profile, we can click on it and drag an actual sprite to the Sprites section of the profile.

Cinemachine

Install Cinemachine from the Unity package manager. It will auto-add it to the main camera.

Click on the virtual camera it created and change “Body” to “Framing Transposer”. Then choose what to “Follow”

Sprites

You can create an “empty” parent object and click and drag sprites underneath it. Children’s position is then relative to their parent.

Collision

We can add a Surface Effector (2D) to our floor which will create a “conveyor belt” movement. We need to make sure it is attached to the edge collider by selecting “Used by Effector.”

For our main object that is interacting with the surface, we want to change the rigid body Collision Detection to “Continuous”

“Rigid Bodies” are the things that physics are acted against in unity.

Scene Managing

We can import `UnityEngine.SceneManagement` to manage scene stuff.

Particles

Two parts:

  • emitter: the object that emits particles
  • particles: the actual particles

Game Dev Notes #1 – Race Car

These are notes from the Complete C# Unity Game Developer 2D Udemy Course

Debug

Debug.Log( "Message" );
Debug message to console.

Collision

Add components:

  • [Shape] Collider (2D)
    • Play with the shape depending on what kind of collision feel you want.
  • Rigid Body
    • Turn gravity to 0 if this is not a platformer
    • Add rigid bodies to other objects if you want them to be pushed.

Scripts:

OnCollisionEnter2D
When colliding with something.

OnTriggerEnter2D
When passing through an trigger object.

Referencing Other Objects

There are a few ways to reference other objects inside scripts.

[SerializeFiled] GameObject <name>
This will create a field in the object’s inspector that you can manually select from the list. This then stores that object in the variable name you set the GameObject to.

So, You Like to Play Castlevania?

On retro gaming and save scumming.

I had never played a Castlevania game before, so naturally I wanted to start at the beginning.

I’m not like this with most series. Unless there’s a continuing story, a la Metal Gear Solid that I need to play all of the games to fully understand (“understand”), I usually don’t have trouble jumping later into a franchise’s life to get to some of the more interesting entries. Certainly the entries with the most quality of life improvements.

Thus it was with great surprise even to myself that I had this strange urge to start playing Castlevania from the very beginning. I can’t really articulate why. The series has grown to almost thirty games and counting. Surely one of the later entries, or at a minimum Symphony of the Night, would have done me just fine.

More

The 2020 Gameological Not Just Game of the Year Awards

Following up on the tradition we started last year, the Unofficial Gameological Discord group has put together another year end list! Looking back on the blog, I only published one post this year, so even though I played a whole lot of games this year, I’ll let that say all I have to say about what kinda year 2020 was.

Games were a consistent escape from the endless reign of terror, and it felt great to finally check off a few backlog games, and explore something new ones. So, in no particular order (except the last one), featuring games both released this year and twenty years ago, here are my 2020 Gameological Not Just Game of the Year Awards:

More

The Plate Has Collapsed

How Final Fantasy VII Helped Me Grieve

This post contains some light spoilers for Final Fantasy VII Remake from Chapter 12 on.

It was the end of May when I started this post, and the height of the COVID-19 pandemic in New York City. The streets were quiet, save for the passing of sirens at all hours of the day. I hadn’t seen my family for months. I missed my sister’s birthday, and she missed her college graduation. Refrigerated trucks were parked outside nearby hospitals. Friends had lost parents and loved ones. All the while, the president mocked us and made it clear he wasn’t going to do a damn thing about it.

Then the George Floyd protests started. The horror of one moment was compounded by another, and it suddenly felt like the last thing the world needed to hear was my thoughts on a video game. I shelved the post.

Six months on, as results for the 2020 election are being tabulated, the pandemic tallies hit new highs, and the next few months, let alone decade, feels more uncertain than ever, I find myself thinking back on Final Fantasy VII Remake often. It was a bright spot during that dark time, taking me by utter surprise and washing me in both nostalgia and a sense of burning understanding and radicalization. This is a game that doesn’t just understand its characters and politics – it understands how people in power enrich themselves at the expense of others, deflect blame onto marginalized people, and take advantage of crises to enrich themselves.

Yes, I’m talking about the plate collapse sequence.

More

The 2019 Gameological Not Just Game of the Year Awards

Ah, 2019. You kind of sucked. I mean I guess you started okay, but around the halfway point you took a turn for the worse and I’m glad to see you go.

But you know what’s always been good to me? Games. I played a lot of games this year. Read into my escapism however you want, but 2019 let me try my first Fire Emblem game, dip further into indie darlings, and deliver packages as a glorified UPS delivery man.

The following is a list of some of the more memorable, or unmemorable, moments from 2019 in gaming.

More

Rock of an Age

“You know, I think Tool’s cover of No Quarter is actually better than the original.”

I almost fell over. My friend and I hailed from opposite ends of the rock spectrum. He wouldn’t consider anything written after 1979 as music. I thought anything that wasn’t alt-2000’s rock was boring. An admission of guilt on his part, that a band from the 90s would usurp the holy grail that is the progenitor of all rock music – Led Zepplin? It was a staggering, blasphemous remark.

The evolution wasn’t out of the blue. It was just another cataclysmic shift in the way he and I began to see music beginning in the winter of 2005.

More

Back to School

My family had a ritual when I was growing up. If we were watching TV and a back to school commercial came on any time before August 15th or so, my sister, my mother, or me would rush to change the channel while my father cackled like a madman at the inevitability of our fate. Summer would end, sooner than we could have thought or hoped, and we’d all be forced to ride the bus to school while my father waved from the sidewalk before hopping in his car, gleeful with the knowledge we were suffering alongside him in our own way.

More