Day 2: Transform, Destroy, Instantiate!

Brittany Lumanlan Martin
2 min readNov 25, 2020

--

I didn’t get as far into the 2D Game Development course as I had hoped on my first day, but made great progress today. I left off halfway through the Create the Player course, after briefly pausing to study a few sections in the C# Survival Guide — which ultimately helped me better understand C# coding concepts today!

In the title of this article are a few of the keywords I studied today. Each of them, when applied via script to an object (or “prefab”) will allow or not allow that object to do many things, e.g. execute a movement of your choice, create limits as to how far your character can move around the game scene, and even fine details as to where an object will “instantiate” or spawn. I’ll post examples and explanations of some of these concepts below.

In this video, you see my main character, the cube, move around and shoot off some lasers into the distance. Some highlights include:

  1. When the cube moves horizontally and reaches the edge of the game scene, it will “wrap” or reappear on the opposite side of the screen; when the cube moves vertically, it is blocked from wrapping and is essentially confined by an invisible roadblock. The bulk of this was done using the actions “transform.position”, “transform.position.x” or “transform.position.y”, in which parameters are set in terms of how far up or down the character can move.

2. The lasers instantiate and are offset just above the cube instead of from directly within the cube, a fine detail Jonathan (founder of GameDevHQ) covers in the video “Challenge Laser Position Offset Reboot”. Basically, it makes the action look cleaner and less like a glitch.

Tonight I’ll be finishing up the section “Shooting” and moving onto “Enemies”. I’ll be back with another update tomorrow on my internship progress!

--

--

Brittany Lumanlan Martin
Brittany Lumanlan Martin

No responses yet