Coding Lessons for Block 2

Coding can be one of the hardest and most intimidating things to learn when you first think about learning game development. But it can be learned one lesson at a time, and it’s just like any other skill – learn it and practice it, and you get better and better at it all the time.

In this block, we start with Virtual Coder to learn the basics and the terms and how they work, from functions and function arguments, to For Loops, to While loops, the basis of a lot of different coding blocks for video games.

After that, we looked at ideas for how to create Cutscenes in SwiftPlaygrounds and solve puzzles as well, to get the practice we need before we went into Codea, a coding and app development program for iPads.

And then we went straight into Codea to learn how to create a Cutscene, by bringing in elements and characters, animating the characters, importing sprites to add text bubbles and animating them, adding sound effects to our scene and then exporting the scene to work on later. – Exporting in Codea

This was a small lesson on how to export your coding and work out of Codea. It isn’t that much, because my current computer doesn’t have the capability of working with Xcode, but it gives the basics on how to do that. I may redo this lesson once I get my new computer, because both the new OS on my iPad and the new computer can do what we need. – Sound Effects in Codea.

While Codea doesn’t have the ability to add sound effects you create, which is why you will want to use Xcode, it does allow you to add theme music and sound effects to your scene in a variety of different ways, so lets look at them. – Adding Sprites to Codea.

Codea allows you to import PNGs and other graphics into it, so lets add some dialogue graphics for our Turd Throwing Monkeys into our scene to give it more storytelling elements. – Animating in Codea.

In this lesson, we look at how we code animation in Codea through tweening (a computer calculating movements between two spaces in time) and inputs. – Welcome to Codea.

This is the first part of the Codea series, where we setup our cutscene and we look at all the elements within Codea which will help us on our way to using Codea as a coding program. – Programming and Puzzle Solving.

Using SwiftPlaygrounds, we look at how to create a good puzzle, so we can create similar puzzles in our video games. – Programming and Cutscenes.

Using SwiftPlaygrounds, we can look at ways of creating cutscenes, and interactive animations that will entertain our audience. – Virtual Coder – While Loops

While Loops are loops with a conditional on it – as long as X variable equals Y condition, than do this, else, do something else – so we learn how Virtual Coder handled those puzzle levels to start thinking about how to incorporate that into game development. – Virtual Coder – For Loops

For Loops are still loops with Conditionals, but the condition is i = number, meaning the number of iterations of those actions will continue until the interactions equals the number – like 4 or 5 iterations. – Virtual Coder – Functions and Function Arguments

Functions are the basis of programming. Self contained blocks of code that keep on doing something when they are called, so you only need to call one line, while defining the function.

Enjoy guys!


Coding Videos so far

Introduction to Coding –

Coding is the first scary bottleneck for those who want to design video games. Unless you take time to understand the basics, everything can be so intimidating. But if you change your mind on programming, and see it as a honey do list for a computer, than coding becomes far less scary. You just need to learn how computers are instructed and start taking control over it.

For those who have iPads, feel free to download SwiftPlaygrounds and play around with Coding 1, I use them for all my coding lessons right now.

Swift Playgrounds by Apple

Introduction to Functions –


InfoGraphic –

Swift Playgrounds –

Functions allow programmers to group lines of code to be called in later parts of code, to help reduce the amount of coding you have to do to accomplish a task. You can also use functions within other functions to eliminate as much coding as possible.

As coders, we want to reduce the amount of work we do, and functions allows us to do that very thing.

Thanks for watching and Making Gaming Great Again!

Introduction to For Loops –

Description –

Resources –

For Loop definition –

SwiftPlaygrounds –

For Loops are excellent ways to group a bunch of functions that are the exact same together. In video games, these are the NPCs patrolling around, going to point A doing a couple of things and then going to point B in which the do the exact same thing before they go to point C, which then you can reset the to start at the beginning again.

Introduction to Conditionals –

Description –

Resources –

Definition of Conditional Programming –

SwiftPlaygrounds –

Conditional programming can help game developers make their games more difficult, provide missions and quests with reward systems, level up scripting when a character’s experience hits a certain number, and what happens when a character hits another character. It is the backbone of coding a game, so it is essential for aspiring game developers to learn and get really good at conditional coding.

Thanks for making games great again!

Introduction to Logical Operators –

References –

Logical Operators definition –

SwiftPlaygrounds –

Logical Operators, defining things if two combined variables are true, or if a variable is untrue, or if a variable equals this or that allows game designers to provide puzzles and unique experiences to their games. Building on the conditional programming that is very important for game programming, because games are all about conditions, this helps ensure unique experiences for gamers.

Introduction to While Loops –

While Loops –

SwiftPlaygrounds –

While loops combines the three topics we had taken previously, the for loop, conditional coding and logical operators. It helps define NPC behaviours in games to animate your world. You can use a while loop to have a shopkeeper in a game stay in their shop until a certain time of day, after which it will go home – so the loop for the shopkeeper would be while the time condition is true, the shopkeeper stays in the shop, else if the time condition is false than the shopkeeper goes home, and then the same loop is created every single day in that loop.

Thanks for watching and making games great again.