Theory Tutorial- Programming Terms
- Subject: Theoretical Tutorials
- Learning Time:
We use a lot of terminology in Programming, this post aims to explain and link some of the programming terms we talk about and you’ll need to use and learn with some of the actions and tutorials you’re doing to use. It assumes a basic knowledge of C# and Visual Studio.
C# Flappy Bird Hunting Game MasterClass
Create a interactive shooting game with Flappy Birds
- Use OOP to make the game
- Backgrounds and Play Music
- Work with Multiple Forms
- & Much more ..
In this new course we will recreate the very popular game with a twist. We will create this game from an empty project to a fully compiled EXE file using Visual Studio. Click here to see the full course details.
Toolboxes and controls
Toolboxes and controls are historically the key components used in making a GUI based C# app, the toolbox contains all the controls that can be added on. The screenshot below shows some of the controls that can be added from visual studio to a windows form. This includes things like textBoxes, buttons and checkboxes amongst many others, most of which are concerned with getting information from or to the user.
Selection is simple, it’s the process of reacting to a value and doing something if it’s within a certain range of a value. For instance, if a variable X is less than 10, or greater than 5 but less than 10. If statements are generally the best and most used example of selection withing C# programs. Some examples of selection can be found in the following programs;
Loops again are more simple than people think, they just repeat something over and over until a condition is met (e.g. a number gets too big or it’s repeated too many times). Loops are generally represented by either “For” loops or “While” loops.
Menus have become the primary way of helping people navigate programs, particularly drop down menus. We’ve all seen them and there are lots of ways of implmenting them, the youtube player tutorial shows you one way.
Event handlers deal with what happens when an event is triggered. An event is generated by the program to signify that something has happened, a player hitting something in a game for instance often generates an event. Other events are clicking buttons, values getting too high and lots of others, for this reason, almost all of the windows GUI C# programs use event handlers. Double clicking any button and adding code is adding code to the pre-generated event handler for that button. (See screenshot). Event handlers are particularly used in the following tutorials;
Triggers are linked to event handlers, they are the thing that triggers an event, the thing that launches it, often they are implicit, not necessarily clear. Things like button clicks are event triggers, they trigger the buttons “OnClick” event, which is handled by the event handler. The tutorials above are linked to triggers too.
These are things presetup and defined in the C# language that you don’t have to write code for, we just call them. These are things like; ToString(), ConvertTo, Console.out, ReadLine or MessageBox.Show(). None of these you write code for you jsut use. As such almost all the tutorials on this site use this code.
These are best seen when you create a new C# program via visual studio, whilst not necessarily a part of the language they’re useful because they setup your program with lots of predefined code ready for you to use. This is things like links to forms, a presetup skeleton HTML document or code for an app. There are tons of templates, if you uss Unity the C# scripts you setup their are created from their own template for Unity.
Using integrated development environment (IDE)
Again, another easy one, it’s all about using a program that pulls together features of the language and provides you with helper functions. Use Visual Studio, you’ve used an IDE.
global, local, and static variables
There isn’t a tutorial on this site for these, rest assured there will be soon. These can be hard to understand, the easier are global and local.
Global variables can be seen through the whole of that piece of code, they are often defined at the top. The picture to the right shows a global variable.
Local variables can only be seen in that segment of the code, for instance, a local variable inside a function can only be seen inside that function and not outside. The picture to the left is a local variable. It can only be seen in the “Main” section of the program.
Easy way to remember it, variables can not be seen outside of the curly bracket above and it’s matching one below. Find the curly bracket above and click directly before it, it should highlight that bracket and it’s matching one.
Static variables are harder to explain, they’re easier to see in games where you often have multiple copies of the same script. A static variable is what’s called a class variable, each variable declared static has the same value as all the others for that script no matter how many copies of it are running. For instance, a variable that tracks number of enemies in an enemy spawn script could be declared static, if that variable is increased in one script, it’s value is increased in all the scripts, they all have the same value.