C# Tutorial – Picture Box collision between Player and Randomly Spawned Items in Windows Form

Hi, in this tutorial we will explore how to  create a windows form game where you can move the player left, right, up and down, spawn other items picture boxes in random positions inside of the form, move the player collide with the other picture boxes and finally remove the item picture boxes from the windows form application. We want to do all of this from the C# programming script. As a added bonus lets also code in how to change the back colour of dynamically created picture boxes in the app.

Lesson objectives:

  1. Create a randomly spawning picture box app in windows form application
  2. Work Picture Boxes, Timer and Label in the form
  3. Code in Key Down, Key Up and Timer event#
  4. Create custom function to add the picture boxes
  5. Work with Arrays and Lists
  6. Add and move items from lists and from the main windows application
  7. Create a spawn time counter that controls how often the objects are spawned in the form


Full Video Tutorial –

Code From the Project –


Comment on this tutorial and let us know how you got on -