How to make PAC MAN game in Windows Form and C# with Visual Studio

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • Download images here - www.mooict.com...
    In this tutorial we will be making a simple pac man game in visual studio with Windows form and C#. In this game we will control pac man in 4 different directions. Up, down, left and right. In the images you will find a GIF to represent all 4 directions. You have 4 walls and 3 moving ghosts in the game. The main objective of this game is to, collect all of the coins and not touch the ghosts or walls. IF you do then the game is over.
    3 Ghosts in the game will have their own movements and collision with the walls and the player. This process will give you an idea of how to program standard AI inside of a game and you can use the same process in other projects.
    We will learn how to make this together by adding of the elements manually and then writing the c# script animate and logically progress through the game.
    Instead of removing the elements from the form this time around we are using a different approach. We will show you how to make a component invisible in Windows Form once you have interacted with it, and gain a score from it.
    Hope you have fun with this one, and keep making stuff it really doesn't matter what it is long as you keep at it you will only get good at it.
    Moo out.

Комментарии • 100

  • @mooict
    @mooict  3 года назад +4

    Download this project here github.com/mooict/Pac-man-game-tutorial-in-windows-form

  • @starrypolaris6876
    @starrypolaris6876 3 года назад +7

    I have to make this game as homework , and as a starter this helped me a lot, lot lot.
    Still I needed something a bit more complicated with the ghosts, they're supposed to do a different task each, im still figuring that out!
    Thank you a lot!!

  • @HeikkiCoga
    @HeikkiCoga Год назад +1

    You really helped me a lot!! Thank you so much!! I've learned a lot of things thanks to you!! :DD Good vibes to you wherever you are!!!

    • @mooict
      @mooict  Год назад

      Thank you for the kind comment. I’m glad this tutorial was helpful 😊

  • @Petra_Christalbert
    @Petra_Christalbert 2 года назад +1

    Thanks dude, up helped me so much on learning about "How to use foreach"... Thank you so much ~~~

  • @AlexAnder-fk2yg
    @AlexAnder-fk2yg Год назад +1

    Thank you for the video, good and simple manual.

  • @ronixxfnbr6483
    @ronixxfnbr6483 6 месяцев назад +1

    what a video thankyou so very much, u saved my coursework

    • @mooict
      @mooict  6 месяцев назад

      Glad it helped

  • @SuzanaJoanaRosárioCaiacaCaiaca
    @SuzanaJoanaRosárioCaiacaCaiaca Месяц назад

    I love this video ❤️

  • @arvsnacs422
    @arvsnacs422 4 года назад +2

    Thanks. Done it. Next stop jet shooter.

  • @rosearysh
    @rosearysh 2 года назад

    thank youu
    Your training was perfect.....
    I wish you success^^

  • @AdewumiT264
    @AdewumiT264 2 года назад +1

    I’m having problems with my program. It keeps saying there is an error when I write private void reset game. Also I cannot properly move Pac-Man around. I do not know the problems I’m having as I have followed all of your steps. Any help?

  • @ViajeLibre
    @ViajeLibre 4 года назад +1

    Nice!!! Good Work

    • @mooict
      @mooict  4 года назад

      Thank you im glad you like it. Let me know if you want any other tutorials

  • @user-vl6ew1nd9f
    @user-vl6ew1nd9f 3 года назад

    Thank you! the best game tutorial in my life)

  • @WHITEHAPPY123
    @WHITEHAPPY123 Год назад

    thank you sir you teach me how to create a game using c#

  • @SP-hr1fc
    @SP-hr1fc 5 месяцев назад

    How can I make this a 2 player game by making one of the ghosts move using the wasd keys?

  • @mahyarrad-vo3ot
    @mahyarrad-vo3ot Год назад

    I have a question i desigend the form loike you did but when i debuged the game pink and yellow ghost werent in thier place and i didnt finish the code at that time

  • @martinalejandromana7678
    @martinalejandromana7678 Год назад

    Very good game

  • @Splathe
    @Splathe 7 месяцев назад +1

    ty

  • @connorboyle
    @connorboyle Месяц назад

    'KeyPressEventArgs' does not contain a definition for 'KeyCode' and no accessible extension method 'KeyCode'. It seemss to be fine in keydown but not working in the keyisup function?

    • @mooict
      @mooict  Месяц назад +1

      Add a key up event to the form instead of key press event. Key press event do not support key code

    • @connorboyle
      @connorboyle Месяц назад

      @@mooict thank you!

  • @user-js2dn2bt1m
    @user-js2dn2bt1m Год назад +1

    Thankyou just made this for small project :) Best tutorial!!!!🫶🏻🫶🏻❤️

    • @mooict
      @mooict  Год назад

      Glad it was helpful!

  • @robertmanolache5728
    @robertmanolache5728 4 года назад +3

    How do I make PacMan stop when it touches the wall instead of the game ending?

    • @mooict
      @mooict  4 года назад +1

      I'm currently working on the new pac man tutorial with wall hits. Still a work in progress ☺️

    • @robertmanolache5728
      @robertmanolache5728 4 года назад +1

      @@mooict I found a way to do this, but it takes a long time.

    • @mooict
      @mooict  4 года назад

      Noice well done 👍

    • @robertmanolache5728
      @robertmanolache5728 4 года назад

      @@mooict Thanks

    • @alexc98765
      @alexc98765 3 года назад +1

      Can somebody help me with this please?

  • @eljose153
    @eljose153 4 года назад

    I love this video 🖤

  • @vidhirughani489
    @vidhirughani489 3 года назад

    Game over label is not come when the game is over and in the code u gave there is no reset and game over function in the written code

  • @josezambrana5596
    @josezambrana5596 4 года назад +1

    God work !!

    • @mooict
      @mooict  4 года назад +1

      Thank you. Glad you liked it. I'm working on WPF C# version of this at the moment will be up soon hopefully

    • @josezambrana5596
      @josezambrana5596 4 года назад +1

      @@mooict great, I'll be waiting for you
      (postscript I am Bolivian, forgive my English)

  • @megclements-paterson9482
    @megclements-paterson9482 4 года назад +1

    I can't get my ghosts to slow down :/ they bump against the walls but really really fast, they are set to 1 :( and they are still not slowing down... any suggestions how I can fix this?

    • @megclements-paterson9482
      @megclements-paterson9482 4 года назад +1

      OMG I fixed it it doesn't matter! haha check those curly braces everyone!!

  • @highttydota8590
    @highttydota8590 Год назад

    Thx bro

  • @akura0_0
    @akura0_0 Год назад

    please can you make a video of how can make the coins make a sound we pacman collect it

    • @mooict
      @mooict  Год назад +1

      Hi, I've done a video on how to play different sound files in windows forms on the channel. That should help you on how to include sound to this type of game.

  • @unajokic539
    @unajokic539 Год назад

    If you can help, the yellow ghost is moving from picturebox 4 to the right, instead of picturebox 3, how can I fix it?
    Thanks ☺

    • @mooict
      @mooict  Год назад

      Check the name of the picture box 3 and 4 in the property window. If it’s James differently you can change it in the code.

  • @noonecaresbish
    @noonecaresbish 2 года назад

    I have a question... Why do you use pacman.Left
    ( if (goleft == true)
    {
    pacman.Left -= playerSpeed;
    pacman.Image = Properties.Resources.left;
    }
    )
    and pacman.Top
    ( if (godown == true)
    {
    pacman.Top += playerSpeed;
    pacman.Image = Properties.Resources.down;
    }
    )
    for pacman's movement and not pacman.Right or pacman.Bottom?
    I mean if he goes bottom, why don't you use pacman.Bottom ?

    • @mooict
      @mooict  2 года назад +1

      I should have used the bottom and right at the time but I didn't because I got used to programming similar apps on JavaScript before this. So I think my old practice just translated to this one. You can use picturebox.Bottom and pictureBox.Right easily to achieve the results you need for your projects.

  • @martinalejandromana7678
    @martinalejandromana7678 Год назад

    Muy buen juego

  • @csarpiz-codmobile7149
    @csarpiz-codmobile7149 3 года назад

    is this game made with object-oriented programming ?

    • @mooict
      @mooict  3 года назад

      No I haven't used OOP in this example

  • @miguelsandoval2937
    @miguelsandoval2937 4 года назад +1

    is this applicable for 2010?

    • @mooict
      @mooict  4 года назад

      Yes it is

  • @bnda-ew8od
    @bnda-ew8od Год назад

    hiii my pacman is not moving why please help

  • @TheDonaldskates
    @TheDonaldskates 3 года назад

    in the main game timer part it is telling me resources does not contain a definition for left, right, etc

    • @mooict
      @mooict  3 года назад +1

      It means the pictures in your resources are called different than left right etc. You can open the resources and rename the pictures to fix this issue or just call them as they are named in there.

    • @TheDonaldskates
      @TheDonaldskates 3 года назад

      @@mooict thank you, so far you're my favorite person on the internet to help me with game dev

  • @kurizu946
    @kurizu946 3 года назад

    Could you please made this into console.app visual studio?

  • @mizucc9211
    @mizucc9211 3 года назад

    When i try to write "pacman.Left" (14.05) the Left part turns red, why is that? And the same thinga applies to pacman, but i added him to the int part but idk if that is correct :/

    • @mooict
      @mooict  3 года назад

      The pacman is name of that picture box. Integers don't have left or top properties. Name the picturebox pacman in the form and then you can access left and top properties of the pacman.

  • @sar0_00-t2v
    @sar0_00-t2v Год назад

    My pac man doesn't eat the coins and the score doesn't work. What can I do?

    • @mooict
      @mooict  Год назад

      Hi, check the tags for the coins and make sure its the same as the tutorial.

    • @sar0_00-t2v
      @sar0_00-t2v Год назад

      @@mooict Thank you, it worked!

  • @rizkyzein2410
    @rizkyzein2410 3 года назад

    What is the template. Visual Basic or Visual C#?

    • @mooict
      @mooict  3 года назад

      This is C# .Net Framework

  • @urosgojak9317
    @urosgojak9317 4 года назад

    I have a problem when i press arrow to go its doing it job,but when i put my finger off the arrow or i change direction game restart it self

    • @mooict
      @mooict  4 года назад

      Check the key up event from the tutorial. I think it's restarting the game from any key release instead of enter key.

    • @urosgojak9317
      @urosgojak9317 4 года назад

      @@mooict thanks,nice contect i like it so much.Will u make a video how to make levels in this game?

    • @mooict
      @mooict  4 года назад

      @@urosgojak9317 you can add more levels by inserting new form to the current project in the solutions explorer. From there you can make a new level and load it when the current one has been passed.

  • @ImusingX
    @ImusingX 4 года назад +1

    i always wanted to make Creeper Eats Ghosts

  • @shilperwork9755
    @shilperwork9755 3 года назад +2

    i made a maze and put coins all over the maze (now my hands hurt)

  • @yenyen4963
    @yenyen4963 5 месяцев назад

    the coins are not disappearing 😭😢

  • @aidanacero4912
    @aidanacero4912 3 года назад

    The character won't move and the code doesn't seem to have any errors.

    • @mooict
      @mooict  3 года назад

      Check if the key down and key up events are linked to the form. You can do this by going to the events window inside the properties.

    • @aidanacero4912
      @aidanacero4912 3 года назад

      @@mooict They are

    • @mooict
      @mooict  3 года назад

      @@aidanacero4912 are the ghosts moving in the game?

    • @aidanacero4912
      @aidanacero4912 3 года назад

      @@mooict I haven't added moving ghosts yet and in the game I'm making they are sharks and yes I have added my own names in the code and not ghost and Pacman names.

    • @aidanacero4912
      @aidanacero4912 3 года назад +1

      @@mooict BRUH I JUST REALIZED IT WAS BECAUSE I HAD A CUSTOM WINDOW BORDER

  • @dkracingfan2503
    @dkracingfan2503 4 года назад

    What version of Visual Studio are you using?

    • @mooict
      @mooict  4 года назад

      2019 version

  • @noonecaresbish
    @noonecaresbish 3 года назад

    My pacman is not moving :(

    • @noonecaresbish
      @noonecaresbish 3 года назад

      Neither do the ghosts

    • @mooict
      @mooict  3 года назад

      Hi have you enabled the timer?

    • @noonecaresbish
      @noonecaresbish 3 года назад

      @@mooict Yes

    • @mooict
      @mooict  3 года назад

      @@noonecaresbish check if the timer event is linked to the timer and the key down and key up are linked to the form.

    • @noonecaresbish
      @noonecaresbish 3 года назад

      @@mooict I solved the problem 😄

  • @shubhsanganeria9483
    @shubhsanganeria9483 4 года назад +1

    Is this an Asmr

    • @mooict
      @mooict  4 года назад

      It can be 👍

    • @shubhsanganeria9483
      @shubhsanganeria9483 4 года назад

      @@mooict 😂😂😂😂 yeah

    • @shubhsanganeria9483
      @shubhsanganeria9483 4 года назад

      Btw should i understand visual studio fully before starting unity?

    • @mooict
      @mooict  4 года назад +1

      @@shubhsanganeria9483 no you don't have to, it's C# you will need to be familiar with to use unity properly.

    • @shubhsanganeria9483
      @shubhsanganeria9483 4 года назад

      @@mooict oh kk thanks👍👍😄

  • @shilperwork9755
    @shilperwork9755 4 года назад

    "coins"
    lol coins u should put dots

    • @mooict
      @mooict  4 года назад

      Animated coins look better but I get your points. Dots would have much more optimised for this game but look how shiny they are 😂

    • @shilperwork9755
      @shilperwork9755 4 года назад

      yeAh coins have animations and dots do not have AND THE cOiNs ArE sO sHiNy

    • @shilperwork9755
      @shilperwork9755 4 года назад

      and is the size of the window really cares like can i use something random instead of what you used

    • @shilperwork9755
      @shilperwork9755 4 года назад

      AND WHY MS PAC-MAN

    • @user-do7jj6ch2q
      @user-do7jj6ch2q 3 года назад

      @@shilperwork9755 why are you being so rude for