Game coding for beginners


/John Horton

About John Horton

Writer at
  • C# beginner coding tutorials

Making use of variables in C#

By |

Having just learnt what C# game variables are and that they store values that represent the data in our games, it is probably obvious that these values held by our variables will need to be changed as the game is played. For this we need C# operators. Operators in C# are just like mathematical operators we used in […]

  • C# beginner coding tutorials

Conditions and decisions

By |

Condition checking in games is all about making decisions. How do we “know” if the player has completed the level or crashed a ship? How do we detect if the ball has reached the edge of the screen and needs to bounce back the other way? C# has the keyword which helps us detect […]

  • C# beginner coding tutorials

Loops in C#

By |

Loops are how we repeat the same part of the code more than once. This can simply mean doing the same thing until the code being looped over prompts the loop to end or it could be a predetermined number of times as specified by the loop code itself.

We will look at two types of […]

  • C# beginner coding tutorials

Structuring C# games with methods

By |

C# Methods allow us to organize and our code into named, logical, sections. As our C#/Unity game projects become more and more advanced with exciting features and deep systems, methods will be one of the constructs that make it possible. We have already seen the Unity method in the Unity & C# part 1 […]

  • C# beginner coding tutorials

Object oriented programming with C#

By |

Object Oriented Programming, or OOP for short, is the way almost all programming is done, in almost all languages. It hasn’t been this way forever and there are some exceptions but if you want to make games, it’s a topic that needs to be learned. OOP is designed to help us write code for games […]

  • c-sharp-beginner-tutorials-works-with-unity-thumbnail

Handling data with C# arrays

By |

All these objects, variables and types are useful but what happens when we have hundreds or thousands of them? How can we possibly keep track? C# arrays are the solution and in this 5-minute tutorial, we will see the simple way that we can organize objects and variables into arrays. Then we will waste no […]

  • Asteroids irregular polygon collision detection

Collision detection: Irregular polygons (Asteroids) using the crossing number algorithm

By |

Testing for collision with an irregular polygon is the exact same problem as if you were doing collision detection for an Asteroids game clone. If you don’t know what Asteroids is you can learn about it here. As this helps us visualize the problem I will present this whole tutorial in those terms. This collision […]

  • Nearest neighbour collision detection

Collision detection: Neighbour checking

By |

This method allows us to only check objects that are in the approximate same area as each other. It can be achieved by checking which neighbourhood of our game a given two objects are in, and then only performing the more CPU intensive collision detection if there is a realistic chance that a collision could […]

  • Radius overlap collision detection

Collision detection: Radius overlap method

By |

This method is also checking to see if two shapes intersect with each other, but as the title suggests, it does so using circles. There are advantages and disadvantages compared to other methods.

The radius overlap method works well with shapes more circular in nature and less well with elongated shapes as shown in the image […]

  • Rectangle intersection collision detection

Collision detection: Rectangle intersect method

By |

Rectangle intersection detection collision detection is really straightforward. We draw an imaginary rectangle; we can call it a hitbox or bounding rectangle, around the objects we want to test for collision. Then, test to see if they intersect on each and every frame of the game. If they do, we have a collision.

Where the hitboxes […]


By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.