
Learn to build WinForms games in C# from scratch, including snake, bubble breaker, pong, and arkanoid, using two dimensional arrays, loops, and object oriented programming for movement and scoring.
Learn to build a hungry snake game in C# and WinForms, where the snake eats fruit and donuts, grows by one, and ends when it hits a wall or itself.
Define an 11x11 game board with walls and a 10x10 play area, where each 35-pixel cell can be empty, hold the snake, or contain a randomly generated bonus.
Create a Windows Forms game board by adding a picture box sized 420 by 420, configuring a timer for movement, and loading an image list with bonus, snake, and walls.
Set up a random generator, define enumerations for gameboard fields and directions, and implement a snake coordinates structure with arrays to render the game on WinForms.
Initialize key variables in the form constructor: create an 11 by 11 gameboard field (to include walls) and a 1D snake coordinates array, plus a new Randolf for randomness.
Initialize a 420 by 420 bitmap in the form load event, clear it white, paint walls using the wall image, and place the snake with bonuses on the 10×10 board.
Place the snake with the head at (5,5) and body at (5,6) and (5,7), accounting for 35-pixel squares. Use a for loop to spawn four bonuses via a bonus method.
Learn to paint bonuses in a C# WinForms game by randomly selecting bonus images, spawning four bonuses on free grid cells, and drawing them at 35 pixels.
Set up snake movement by handling form's key down event, reading arrow key presses, updating the snake direction with a key code switch, and stopping the timer on game over.
Learn snake movement logic: on each timer tick, update the body, free the tail, compute the new head from the user direction, check walls and self-collisions, and refresh the gameboard.
Remove the last snake piece by drawing a filled square at the last body coordinates, update the gameboard to free that cell, and prepare to move all body parts upward.
Update the snake x y array by shifting each body segment to the previous position using a reverse for loop from end to index 1.
Update the head coordinates based on direction enumeration, moving y for up or down and x for left or right; defer refresh until updates and check walls and snake body.
Learn to detect snake wall collisions by checking the head's x and y against 1 and 10, triggering game over and refreshing the board.
Learn to detect collisions by checking the snake head against body coordinates on the game board; end the game when they collide and handle growth after eating the bonus.
Check snake collision with the bonus, add a body segment, and update the gameboard and score; ensure bonus generation is bounded by snake length to prevent infinite loops.
Draw the snake head image from the image list using index five, place it at x and y coordinates scaled by 35 pixels, assign to the game board, and refresh.
Run the snake game to observe movement, bonuses, and score increases as the snake grows. Explore the x y array of structures for coordinates and wall or body interactions.
Build a bubble breaker game by highlighting adjacent red bubbles, removing them, and refilling from above and the left, while learning two dimensional arrays and game flow.
Open Visual Studio, create a Windows Forms project, and use the floor as the game board; rename the form and add a label to display the score of selected bubbles.
Set up the bubble game data in C# WinForms by defining color sets none, red, green, yellow, blue, purple; constants for bubbles and size; random generator; and two-dimensional color arrays.
Initialize variables in the constructor after initialize component, set up a random number generator, and prepare color and selected bubbles arrays tied to the number of bubbles for game board.
Populate the game board with bubbles by looping through rows and columns, randomly assigning one of five colors and initializing the score to zero, then render bubbles on the form.
Draw colored bubbles in a WinForms app using the C# drawing library and the Paint event. Map array colors with a switch statement to draw each bubble.
Learn to draw gradient-filled bubbles in a C# WinForms app using the paint event, graphics.fill ellipse, and a linear gradient brush.
Explore how 2d coordinates map to 2d arrays in a 5x5 game board by separating x and y positions from row and column indices, and synchronize painting bubbles on form.
Experiment with bubble visuals by adjusting the initial color, gradient movement, and bubble size to produce different stripes and gradients.
Create a skeleton of WinForms methods to handle bubble popping: select neighboring same-color bubbles, show color, remove them, update score, and animate drops and shifts on mouse down.
Use the mouse down event to capture click coordinates, convert them to integer grid indices, and map the click to the correct bubble by size.
Implement the game skeleton around a mouse down event to select bubbles with the first click and remove them with the second click, updating the score and label.
Remove bubbles from the form by looping the game board and setting selected bubbles' color to none, then invalidate the form to trigger the paint event and refresh the display.
Clear the selection by iterating through all bubbles and unsetting their selected flag, resetting the selected count to zero, and hiding the score label to reflect no active selection.
Determine game over by scanning the board for neighboring bubbles of the same color; the has more moves check iterates cells and returns true if a move exists, otherwise false.
Display a score label beside selected bubbles by a private set label method, compute score as n*(n-1) for n chosen, and position the label using bubble size with offsets.
Explore a path-finding approach to selecting neighboring bubbles of the same color, using independent direction checks (above, below, left, right), backtracking, and visited tracking to count the selected bubbles.
Implement a private highlight neighbors routine using row and column to collect selected bubbles, track positions in a two-dimensional array with a position counter, and loop to retrace the path.
Implement a loop-based path finding method that explores the four directions from a bubble, moves to the end of a same-color run, skips selected bubbles, and updates selection and indices.
Learn a loop-based path finding approach in a C# WinForms beginner course. Practice selecting bubbles below by comparing colors, updating indices, and tracking positions as you move up and down.
Learn a loop-based path finding method for selecting bubbles to the left, with column index checks, color verification, and position tracking to navigate left before moving right.
The lecture guides you to implement a rightward path finding loop that selects the bubble to the right, checks the next column, ensures it's not last, and backtracks when blocked.
Use a loop-based path finding method to retrace steps. Decrease the position counter, remove the previous highest position, and locate the position with nested loops over the gameboard of bubbles.
Learn path finding with recursion by replacing the loop with a highlight neighbors recursion that explores up, down, left, and right until an exit condition ends the search.
Use a bottom-up scan per column to identify the first removed bubble, then drop bubbles from above using a per-column counter to fill gaps and leave remaining cells as black.
Implement a void moveBubblesDown method that drops bubbles in a grid by looping columns from bottom to top, using a non-color position and a found flag to move colors down.
Replace removed bubbles with the background by painting a black rectangle in the paint event for invalid colors. Use a default case and an isBubble flag to control painting.
Move bubbles down and then right with a column-based approach in a Windows Forms C# game, handling non-color and color placement, and enable double buffering to prevent flicker.
Generate a bubble column when the bottom left is empty, fill it with random colors, then move bubbles right; ensure correct if-statement placement to avoid recursion and enable selection outlines.
Determine the outline by testing neighboring bubbles' colors and drawing a single border around the selected group. Compute edges using top-left coordinates, bubble size, and coordinate offsets.
Paints the left outline around valid bubbles during the form's paint event. Checks the selected array and left neighbor colors, then draws a white line scaled by bubble size.
Paint the right outline around the selection by offsetting the start point one bubble size to the right, checking adjacent colors, and adjusting x and y coordinates for the outline.
Paint top and bottom outlines by moving left to right across columns, checking colors above to define boundaries. Start at the top-left and advance x coordinate by the bubble size.
Create the bottom outline for selected bubbles in a C# WinForms game by shifting y coordinates 20 pixels and rendering left, right, top, and bottom outlines based on bubble size.
Explore running and testing the bubble breaker algorithm in a C# and WinForms project, verify scoring, moves, and game over logic, and plan a historical scoreboard.
Create a scores class to manage board-size specific score files, track all scores in a dictionary, display the top three with a 'you' placeholder, and save every score.
Learn to read scores from a text file in a WinForms app, using a dynamic scores_<bubbles>.txt filename, parsing comma-delimited lines into a dictionary and handling missing files.
Loop through the file’s scores, order by score descending, take the top three, and display names and points in a message box via a public method for the form.
Create a private method that reads all scores from a text file, sorts them descending, and returns the player's position among them, then displays the result.
Display a final message box showing the player's score and board size, with rank, by concatenating strings, and save the score to a text file after the name is entered.
Write the final score to a public text file after the congratulations message, manage names in a dictionary, resolve duplicates by appending a counter, and use a stream writer.
Instantiate the scores class at game over, use a string builder to assemble the message, display top three scores, and save the player's name to a text file.
Add a text box and a button to the game board, hidden until game over, then position them dynamically and save the entered name to a text file.
Validate player names on button click in a WinForms game, ensuring non-empty input, write the name to the score record, and reset the game for a new round.
Play through a five by five bubble game to verify name entry and scoring. Check the debug and score files to confirm top-three scores update with each play.
Explore a pong game in action with two paddles and a ball that bounces off the top, bottom, and bottles. Learn basic collision, speed control, and ball management.
Create a pong game in C# Windows Forms by adding picture boxes for the player paddle, computer paddle, divider, and ball, center the form, and apply a background color.
Create essential game variables: boolean paddle movement flags, separate player and computer speeds, scores, a random ball start, and a ball position structure with x and y.
Initialize the game state by setting paddle and ball speeds to five, scores to zero, and adding a timer with a 20 ms interval to move the ball.
Position the game elements on the form using left and top properties. Center the ball, place the player paddle on the left and computer paddle on the right, display scores.
Handle key down and key up events for up and down arrow keys to set go up or go down while pressed, and use a timer to move the paddle.
Learn to move a ball one pixel per tick on the x and y axes, bounce at edges by reversing direction, and control speed via pixels per tick.
Move the paddle along the y axis, controlled by the keyboard for the player while the computer paddle moves automatically, and reverse direction at the top or bottom.
Learn ball and paddle collision detection using the bounds and its intersectsWith method on picture boxes, reversing the ball's x direction on each 20 ms tick.
Implement scoring logic by checking the ball’s left position against the board edges, updating the computer or user score accordingly, and calculating the ball’s right edge to detect left-side goals.
Update the score displays on every timer tick; move the ball diagonally up and left, bounce it off the top and bottom edges, and move the computer paddle.
Describe how the timer tick event scores points in a WinForms game by checking ball position, resetting the ball in player's half, reversing direction, and updating computer and player scores.
Handle the timer tick to bounce the ball off the top or bottom, score on left or right contact, and reverse the ball's y velocity when intersecting paddles.
Explore timer tick based collision checks, detecting ball-paddle intersections with rectangles, reversing x or y velocity on impact, and handling scoring and paddle movement in a C# WinForms pong-style game.
Move the paddle up or down while checking the top and bottom bounds to prevent leaving the screen, applying five pixels per tick for smooth, bounded movement.
The timer tick event ends the game when either player or computer reaches 10, stops the timer, and displays a message box declaring the winner (you win or computer wins).
Test and debug the pong game by verifying score updates and ball bounce, while adjusting the form size and the computer speed.
Create a ball class as a picture box clone with x and y properties and a random y spawn, then add ball to the form when the computer hits the ball.
Learn to modify the form to generate ball objects with a dedicated ball class, manage a list of balls, and initialize and display the first ball at game start.
Move each ball on the form with a timer by looping the ball list and updating top and left; regenerate new balls when none remain and scores.
Modify the game to handle ball collisions with paddles and spawn new ball instances, by looping through all balls, detecting top/bottom bounds and paddle hits, and reversing direction accordingly.
Simulate final testing and debugging of a C# winforms paddle-ball game by validating collision detection, ball movement and bounce, scoring updates, multiple balls, and end-of-game refresh.
Create a brick breaker game with varied bricks and a color-based scoring system, featuring directionally controlled ball movement, object oriented programming, and increasing ball and paddle speed with score.
Create the Arkanoid form by dynamically placing bricks and using an invisible picture box as the ball template; set 800 by 600 and enable a 200 ms timer.
Create a static score class with a private total score and a public static get score. Calculate the score from brick color and update the form display; track game over.
Create a brick class for the Arkanoid form that uses a random generator to assign color from six options, along with random size and position to bricks as picture boxes.
Create a get all bricks method that loops through form controls, filters picture boxes by the brick tag, and adds them to a list.
Set the bricks' left and top positions with a private method, using random coordinates that avoid overlap. Implement checkIntersect to scan existing bricks and verify using rectangle intersection.
Position bricks randomly on the form using left and top, looping with do-while until the check intersect method confirms a valid, non-overlapping position, then add to the brick list.
Generate bricks with random colors using a private get color method and a 1–6 switch to blue, red, purple, yellow, green, or black; ensure non-overlapping positions and include sizes.
Instantiate twenty brick objects on the Arkanoid form by looping to create Breaks with the form, then add them to the bricks list and form controls with random colors.
Create a paddle from three synchronized paddles and position them on the form, determining which paddle the ball intersects to bounce left, right, or straight up.
Move three bottles horizontally in five-pixel steps, updating their left positions and clamping at left and right form edges; learn alignment calculations and paddle-ball bounce basics.
Learn to bounce the ball off the paddle using the intersect method to detect collisions with left, right, and middle regions. Adjust x and y movement with a state machine.
Learn how to move the ball left and up by one pixel per timer tick, bounce at edges by reversing an axis, and see paddles move along the y axis.
Create a paddle class for Arkanoid that manages speed as an integer, holds three paddle picture boxes in a list, and initializes them in a constructor with a form reference.
Instantiate three picture boxes in a for loop, add them to a list, and position them as bottom-centered paddles by adjusting left and top properties on the form.
Move three paddles in unison using the left and right arrow keys by updating their left positions with a configurable speed, detected through key event args.
Detect and handle paddle edge collisions in a WinForms game by checking left and right bounds, then reposition three paddles side-by-side to stay within the form.
Instantiate a paddle object on the WinForms form via the constructor, and wire a key down event to call the paddle's move method and test its motion.
Create a ball class in C# WinForms, with speedX and speedY, a private ball picture box, and a timer-driven motion that increases speed and ends the game after three misses.
Initialize the ball in a constructor accepting the form, a template picture box, and a battle instance, set speeds, copy template properties, center on the form, and add to controls.
The move ball method runs every 100 milliseconds to detect game over by counting form picture boxes tagged 'break'; if none remain, it sets game over and shows win message.
Loop through all bricks, detect ball-brick intersection, update the score, remove the brick, and reverse the ball's vertical direction to continue gameplay.
Implement collisions for the ball with left, middle, and right paddles to bounce left, up, or right. Use absolute values to fix speed X and adjust speed Y for bounces.
Corrects ball bounce logic when the ball hits the middle paddle by resetting speed X from zero to five plus increased speed, with positive for right and negative for left.
Track the ball’s position against the form edges to bounce off the top, bottom, and sides by reversing velocity, and reset the ball to the center after each hit.
Move the ball by updating its left and top properties with speed x and speed y, including the increased speed after each paddle hit.
Create and initialize a ball object, enable double buffering. On each tick, move the ball, bounce bricks, update the score, and adjust speeds as the score rises.
Learn to build and debug a brick breaker game in C# WinForms by handling paddle collisions, dynamic speed with score, brick creation timing, and win conditions.
Complete the course and celebrate. Continue by applying new logic and syntax to your C# WinForms project, expanding functionality and practicing recursion or lambda expressions.
Do you know basic C# concepts, and know your way around loops, conditional statements, arrays, and very basics of object oriented programming, but never really had a chance to incorporate any of it into a game project?. If that describes you, then this is a course for you.
Full disclosure: we won't be creating any earth shattering games. What we ARE going to be doing is LEARNING how to use with C# in game projects, and how to THINK like a game programmer. All games will use Winforms (Windows Forms) as the game board.
The goal of this course is three fold
First, is to show you how things work
Second, help you understand how things work under the hood.
And third, to drill the basics so that they become a second nature to you.
This course concentrates solely on creating game logic and algorithms in C#.
We will use Windows Forms as the game board and we'll use events to code the application logic to. This way, we won't get distracted with million other little things that come into play when you try to learn the game programming and a framework such as Unity at the same time. Like I said, the goal here is to LEARN the basics, and to RETAIN the knowledge. What good is it for a beginner to game programming to watch someone build a complex game when three quarter of the stuff presented goes right over your head? Not in this course.
If you go through this course, and if you code along, I am absolutely sure that at the end, you will have great foundation to build on, and you will be able to move to more sofisticated applications and coding styles.
The course consists of four games, and more will be added later if there's enough interest.
The first is a Hungry Snake game.
It's a great game to use to learn basics of drawing on the board, dynamic animated movement, collision, score keeping, dynamic changes to the game, key press events and more. You'll be surprised how little code is needed, yet at the same time, how much of all the mentioned concepts you will understand at the end of this section.
Second is a Bubble Breaker game.
We'll get into details of defining a path for a selection triggered by a player's mouse click. I will show you both loop and recursive solution. We'll learn how to draw bubbles and paint them using gradient colors. You'll understand how 2D arrays relate to 2D x and y coordinates. We'll go into details of Graphics class of C#. We will make the game dynamic and allow for variety of bubble sizes and number of bubbles on the form. We will learn more about mouse events and how to branch the game logic based on user clicks. We will enhance the game with keeping the historical scores in a text file and allowing player to enter his/her score into the file. And in the process, you will not only learn game programming, but become a master of arrays, loops, and Enums.
Third is Pong game. (added June 2018)
A simple game that everyone is familiar with. But, we will go deeper, and I will show - and explain - how to move objects on the form, how to change direction of the movement upon detecting a collision, how to manipulate the speed of an object, how to generate new objects and keep track of their position in real time and much more!
Third is Brick Breaker (Arkanoid clone) game. (added August 2018)
A classic game with a little twist. Our version of the game features randomly placed bricks of random colors and sizes. We will also bounce the ball off the paddle based on what part of the paddle intersects with the ball - left part will bounce the ball to the left, right part to the right, and middle part straight up. Our scoring system will be based on brick colors and as the game progresses, the speed of the ball and paddle increases. And everything will be coded using OOP principles.
This whole course is designed as follow along course. Meaning, you are encouraged to code along with me. Everything is on the video, there are no code snippets being magically pasted into the Visual Studio. Also, I don't want you to just learn the concepts and then forget them a week later. I want you to remember and retain what you learn in this course.
And let's face it - that is possible only when you code along.
And one more thing that makes or breaks learning to program - using what you learn, and using it frequently. Therefore, I code even the repetitive things from scratch and I don't simply just refer you to previous lessons. But that means, that some parts may feel slow and repetitive. However, if you actually code along, I guarantee you will learn, and also REMEMBER what you learned.
But, If you prefer more instructional videos, that show everything once and move faster, then this course is NOT for you. Please keep that in mind before purchasing the course. I encourage you to watch some of the sample videos so you get a feel for the course structure, topic difficulty, and my teaching style.
Now, I made the videos short and to the point. Most videos are only around 5 minutes long. That is deliberate, so each video is a small learning step that is easy to follow.
Alright, there's a lot of coding to be done. So let's code some games!