Pacman in Java, Programming Tutorial 1/2

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 พ.ย. 2024

ความคิดเห็น • 151

  • @agamghotra8619
    @agamghotra8619 3 ปีที่แล้ว +6

    I wish I found it earlier.But I have my exams now and I have to study for them too.

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Good luck with your exams. Come back when you are ready :)

    • @agamghotra8619
      @agamghotra8619 3 ปีที่แล้ว

      @@gasparcoding Thanks a lot. I'll surely come here after a month

  • @BigChunko
    @BigChunko 7 หลายเดือนก่อน +3

    How would i code this if I did not want to use packages

  • @theyoutuber778
    @theyoutuber778 2 ปีที่แล้ว +1

    Hope you get at least a 100K subscribers dude. You are awesome.

  • @aRhand_view
    @aRhand_view 7 หลายเดือนก่อน +1

    Thank you for this fascinating video! Could you explain how to change the coordinates in levelData[] , if I want to draw a new field?

  • @sina841922817028990
    @sina841922817028990 4 ปีที่แล้ว +10

    This is amazing. Thank you for your effort.

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว

      Thank you so much sina! This is a great motivation ☺️

  • @marcinkotulski230
    @marcinkotulski230 3 ปีที่แล้ว +8

    Thank you very much for this videos. It is really helpful for me on my studies. Can I have a source code?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +5

      Hey, you can find the source code to all my videos on my GitHub page. I linked the code in the second video: github.com/Gaspared/Pacman
      Have fun and enjoy. Happy coding! :)

    • @theaveragemegaguy
      @theaveragemegaguy ปีที่แล้ว

      he literally coded it infront of u wtf do u mean

  • @theoroschke7071
    @theoroschke7071 3 ปีที่แล้ว +2

    I'm not sure if you will read this but I chossed programming in school and I don't understand anything. When I copy your code from github eclipse shows me a lot of problems any idea what I could have done wrong ?PS: Are you german ?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      Hey Theo,
      Try to approach the problem slowly. Do normal simple Java programs work for you? For example, can you create a JFrame without problems?
      th-cam.com/video/KHdeeqxdgac/w-d-xo.html
      If that works, can you create this Nyan Cat Game and get it to run?
      th-cam.com/video/6Vc-L0x8z0k/w-d-xo.html
      I still created these two videos on Windows. For the Pacman Game: Did you add the "package-info" file as used in the video? Another source of errors are often the images. If you use Windows, you probably have to use an absolute path to the pictures. So "C:/pic/pic.gif" for example. This causes problems for many users. That's why I didn't use images in my last tutorial for Bomberman. If the error messages become less, then look at them carefully. What does the compiler tell you? Often you can google the error messages and get on the right track.
      Yes, I am german. I can't hide my hard accent ;) Good luck! :)

    • @theoroschke7071
      @theoroschke7071 3 ปีที่แล้ว

      Ey vielen dank für die Antwort ich habs auch rausgefunden irgendwie waren bei dem github code vom model die imports falsch aber es geht jetzt muss nur noch die Bilder jetzt einfügen

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      @@theoroschke7071 Top! Super das du die Probleme schon selbst lösen konntest! :) Dabei lernt man immer am meisten über die Sprache! ;)

  • @ignkai660
    @ignkai660 3 ปีที่แล้ว +3

    Dude thanks for this.. you've got a new subscriber here ☺️

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Thank you so much. I am glad to have you on board! 😃

  • @mpozajoshua9809
    @mpozajoshua9809 4 ปีที่แล้ว +3

    hi i am trying to do a pacman game for my senior college project! what IDE did you use..im pretty green to coding lol

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว

      Hey I use Eclipse as an ide. I just made a video about it a few days ago. How to install Eclipse and Java for Windows and Linux. Check it out here: th-cam.com/video/8Qm6ll7fpSw/w-d-xo.html

  • @Atharva_dixit
    @Atharva_dixit 3 ปีที่แล้ว +1

    I am a beginner in java game developing. I am getting an error in this line
    ghost_dx[i] = dx;
    dx = -dx;
    int[] cannot be converted to int
    please help.........

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      Hey, have you compared your code with the one on Gihub to see if all the data types are the same? github.com/Gaspared/Pacman/blob/master/Model.java
      Is that the target 368 you're talking about? The DX int should only be stored in a location i of the int array. Is everything ok with i? Compare the lines on Github with your code. Happy Coding ;)

    • @Atharva_dixit
      @Atharva_dixit 3 ปีที่แล้ว +2

      Ok I will compare it........thank you very much :)

  • @randommfontheinternet1881
    @randommfontheinternet1881 2 ปีที่แล้ว +1

    would you mind explaining 9:49? if i wanted to use my own image, a dog for example, how would I go about doing that?

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      You can just put your gif file in the folder and adjust the path. You can also find all images and the code on github. github.com/Gaspared/pacman

  • @stekos1893
    @stekos1893 3 ปีที่แล้ว +2

    I dont know how i make the Pictures of my Pacman and of the Ghosts
    Can you Help me

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Hey Stekos, you can download the images from the "images" folder from my Github page: github.com/Gaspared/Pacman
      Note that on Windows you probably need to specify the full path to your images. For example: ("c:/src/images/heart.png")
      Good luck!

    • @stekos1893
      @stekos1893 3 ปีที่แล้ว

      @@gasparcoding yes, i have done this but it didnt Work , i dont know why

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@stekos1893 With images it is always the trickiest in java. It always depends on where the images are stored. I use Linux in the video and the images are in the project directory. Therefore I don't use an absolute path. Normally the absolute path should work under Windows. There are several ways to achieve the goal. First try to display a simple JFrame with an image without the code with the game. If that works, then you can continue with the image in the code. www.dummies.com/programming/java/how-to-write-java-code-to-show-an-image-on-the-screen/

  • @JuanRamirez-fx3tf
    @JuanRamirez-fx3tf ปีที่แล้ว

    17:13 hi! what you mean when you type "dx = -dx;"? My compiler says:
    "Operator '-' cannot be applied to 'int[]' "

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      The expression dx = -dx; is meant to negate the value of dx, which appears to be an array or something other than a single numeric variable. The error message "Operator '-' cannot be applied to 'int[]'" suggests that you are trying to negate an entire array, which is not a valid operation in most programming languages.

  • @morrtz7176
    @morrtz7176 7 หลายเดือนก่อน

    how do i resize it
    every time i costumize the dimension and the panel there's a lot of glitches happen

  • @Highplus03
    @Highplus03 หลายเดือนก่อน

    can i used that same code in android studio rather than in eclipse

  • @luc1537
    @luc1537 3 ปีที่แล้ว +1

    When i set that ghost_dx[i] = dx
    it says that I cannot convert from int[] to int and
    it says this when i do this dx = -dx;is undefined for the argument type(s) int[]. How can I make it work?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +2

      Have you checked your code with the one from Github? github.com/Gaspared/pacman Sometimes there is just a small typo in it and nothing works anymore.

    • @luc1537
      @luc1537 3 ปีที่แล้ว +1

      @@gasparcoding thank you i realised i made a mistake :)

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      @@luc1537 perfect. Happy Coding! :)

  • @bhavaniangadi611
    @bhavaniangadi611 ปีที่แล้ว +1

    When I run the game for the first time the ghost was visible .....from second time ghosts are not visible???......please try to solve my problem......

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      Does the happen every time, after restart etc? The code is on Github github.com/Gaspared/Pacman

    • @bhavaniangadi611
      @bhavaniangadi611 ปีที่แล้ว

      I cross checked it's not working

    • @bhavaniangadi611
      @bhavaniangadi611 ปีที่แล้ว

      The assets aren't visible

  • @lemueltimothy2740
    @lemueltimothy2740 11 หลายเดือนก่อน

    how do i win the game, i just ate all the white dots thing and still nothing happened are there any update for the code?

  • @maytau9201
    @maytau9201 3 ปีที่แล้ว +1

    I have a question Can somebody/I programm an other map sure right?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Yes you can create any map with the commands I explain in the video. Just change the map with the logic. Number 1 is a left border, 2 is a top border, 4 is a right border, 8 is a bottom border and 16 is a point. We simply go through all 225 squares in the maze. For example we have 9 in the screenData array. We have the first bit (1) and the fourth bit (8) set. So we draw a bottom and a left border on this particular square. Have fun

  • @dheerajgiria2823
    @dheerajgiria2823 3 ปีที่แล้ว +1

    dude my game is not starting only i am pressing space bar but nothing is happing pls tell what to do

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Have you compared your code with the one on Github? I heard that some people had problems. Sometimes it's just a small typo and nothing works anymore. github.com/Gaspared/pacman

    • @alabisamad1858
      @alabisamad1858 7 หลายเดือนก่อน

      Hey, did it work? I’m having the same problem

  • @mumbaikachallenge5526
    @mumbaikachallenge5526 2 ปีที่แล้ว

    Such an amazing video bro love it totally!

  • @ciaokakao7762
    @ciaokakao7762 3 ปีที่แล้ว +1

    Great video! What do I need to change if I want to create a game field which is not a square but has different side lengths?

    • @ciaokakao7762
      @ciaokakao7762 3 ปีที่แล้ว +1

      Alright, I found out :)

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +2

      @@ciaokakao7762 Hey, both height and width are defined in line 20 with "private final int N_BLOCKS = 15;".
      github.com/Gaspared/Pacman/blob/master/Model.java
      So you would have to create two different N_BLOCKS variables, one for height and one for width. For example H_Blocks and W_Blocks.
      In line 82: " screenData = new short[N_BLOCKS * N_BLOCKS];" N_BLOCKS defines the size of the screen. Here now the new variables would have to be used. The same at all other places in the code. Additionally you have to change the content of screenData and levelData so that it is no longer 15x15. Furthermore you have to change the line pac.setSize(380, 420); in the Pacman.java class. So that the size fits as you want it.
      So, first the variable N_BLOCKS is the starting point. Overall, some rewriting would be needed. Good luck and happy coding! :)

    • @ciaokakao7762
      @ciaokakao7762 3 ปีที่แล้ว

      @@gasparcoding Thank you so much :)

  • @kavinbucoy-hm4hb
    @kavinbucoy-hm4hb ปีที่แล้ว

    How did u instant put the numbers on bottom of leve data?

  • @titanoboakill9121
    @titanoboakill9121 ปีที่แล้ว +1

    bro can i ask i made it but pacman is no where to be found

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      This is probably due to the images, under Windows the path must be given as an absolute path and not relative, starts mi C:/ etc. Have a look at Guthub where you can find the pictures.

  • @andu174
    @andu174 4 ปีที่แล้ว +1

    hello,it's very nice!
    I'm french and I'm a beginner in C++.
    I don't understand this line "if ((screenData[i] & 48) != 0)
    " in private void checkMaze()
    why 48 ?

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว +1

      I just checked the code again. I shortened the Pacman code for the video a bit. The 48 results from two times BLOCK_SIZE (24) and is a relic from a previous attempt. You can also write 5000 instead of 48, or delete the part (& 48) completely. The game is not affected! I adjusted the part on github: github.com/Gaspared/Pacman Thanks for paying so much attention and for your feedback! :)

    • @andu174
      @andu174 4 ปีที่แล้ว

      Thanks a lot for your answer.

  • @slimy-ge6qv
    @slimy-ge6qv 2 ปีที่แล้ว

    Hallo dude, a really code video, i have a question to minute 17.21, where you wrote ghost_dx[i] = dx dx = -dx, that was underlind how did u fixed it because there is a cut
    thanks for your help

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      You can find all the code on Github. github.com/Gaspared/Pacman/blob/master/Model.java It is linked in the second part of the video. Copy the code and see if there is a small typo somewhere in your code. Happy Coding!

  • @surajkr2327
    @surajkr2327 3 ปีที่แล้ว

    Hey great work on the game. I just wanted to know that are those starting import files that u have added, are those javafx import statements like javax etc. Pls respond at your earliest please.

    • @surajkr2327
      @surajkr2327 3 ปีที่แล้ว

      Are u using javafx for this project?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@surajkr2327 Hey deep frosty, no in this case the imports have nothing to do with javafx. You can see all the code on GitHub: github.com/Gaspared/Pacman/blob/master/Model.java
      Javax simply contains packages that are used as additions to existing packages. For example, under javax is the timer and frame etc. This Pacman is in pure Java and can be started without javafx. Happy Coding! :)

    • @surajkr2327
      @surajkr2327 3 ปีที่แล้ว

      @gaspar coding do u have an insta ID or something where I can talk to u? I have a project to submit which is urgent need to be done ASAP. But it should we using javafx and java. Is there any way that u can help me by adding only javafx to this game and give me please. Please help me

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@surajkr2327 The game is written in java. You could of course rewrite it for javafx with some effort. But it is easier to choose a javafx game directly. On my Github page you can find several games for Javafx. For example Snake or Tetris. There is a tutorial for everything. github.com/Gaspared/tetris

  • @pacificocean8796
    @pacificocean8796 2 ปีที่แล้ว

    hey, you're great! Can you please tell me what unit tests can be created for the application?

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      JUnit should provide everything you need :)
      www.vogella.com/tutorials/JUnit/article.html

  • @bhavaniangadi611
    @bhavaniangadi611 ปีที่แล้ว

    Are any AI based algorithms used in this project???...if yes what are they??

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว +1

      No, there is no AI. Just plain Java :)

  • @andradaxox
    @andradaxox ปีที่แล้ว

    my images dont seem to work.. and i dont know what im doing wrong. how can i fix this?

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      Did u check the code on githib? github.com/Gaspared/Pacman On windows u have to use differnet slahs /\ 🙂

  • @AishiteruGG
    @AishiteruGG 3 ปีที่แล้ว

    bro i lost at 12:30 there's an error when I put "40, this" at timer. how to fix this? please reply

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Compare the code with the code on GitHub. You can find it in the description and under the link: github.com/Gaspared/Pacman Happy Coding! :)

    • @SamifishstarPlays
      @SamifishstarPlays 2 ปีที่แล้ว +1

      You have to add in the import section import javax.swing.Timer;

  • @karlli.264
    @karlli.264 2 ปีที่แล้ว

    i just finished programming it, but in the end if I hit the space it doesn't work. what is the possible problem in my code sir? thank you

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      Did you compare your code with the code on Github? Sometimes only one line is different. Does your editor give you an error message?
      Try to check the code line by line:
      github.com/Gaspared/Pacman

    • @alabisamad1858
      @alabisamad1858 7 หลายเดือนก่อน

      Hey, did it work, I’m having the same problem

  • @releNtless-eu3xc
    @releNtless-eu3xc 3 ปีที่แล้ว

    sorry I have fixed the first issue but now it only gives me yellow warnings (by some of my code being underlined with yellow color only too) and because of this, I can't run the game to see the changes in real-time or what's going on to learn better? yours is the same but you can at least run it? why is that?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      From red to yellow errors is already a progress. :) Which parts are underlined in yellow and which errors does the compailer give you? github.com/Gaspared/Pacman
      Normally the editor should already give you a hint. Google then exactly the error message. Step by step everything runs sometime. :)

    • @releNtless-eu3xc
      @releNtless-eu3xc 3 ปีที่แล้ว

      @@gasparcoding I guess exactly like your :) since you have yellow lines too, but still could run it in this video! what shall I do? Sorry I have also restored my computer and my eclipse doesn't have the window builder extension installed inside my eclipse maybe that's why! Do you need to install that program if you want to launch this game?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@releNtless-eu3xc The Window Builder should not be a problem. It is not used here. But a normal hello world and a jframe window work? www.thoughtco.com/create-a-simple-window-using-jframe-2034069
      Some message should appear on the console to give you a hint in which direction to Google. What is the output at the bottom of the screen? Do you also get yellow errors when using the code from GitHub?

    • @releNtless-eu3xc
      @releNtless-eu3xc 3 ปีที่แล้ว

      @@gasparcoding well, but your's have some yellow lines too! Also, I have to say that I have now copy and pasted this code from your GitHub so it's actually your code now :) lol but it's the class model code block part and up to private final short that have yellow lines, however, I added more lines of code to my program since then so the TAdapter and initGame also been highlighted with red line!
      So I would advise you to just copy and paste your code from GH up to the timer = new Timer(40, this);
      timer.start(); line lol
      }
      plus this @Override
      public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub

      }
      }
      at the end of it if this is the part that causes the program to not function well ;) thx

    • @releNtless-eu3xc
      @releNtless-eu3xc 3 ปีที่แล้ว

      Hello?

  • @subhanibrahimli6880
    @subhanibrahimli6880 3 ปีที่แล้ว +1

    I will have a question for you. What program do you use?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      I use java in eclipse. I recently made a video about how to install it. th-cam.com/video/8Qm6ll7fpSw/w-d-xo.html

    • @subhanibrahimli6880
      @subhanibrahimli6880 3 ปีที่แล้ว

      @@gasparcoding Thank you so much ❤️

  • @thornadotrigger3073
    @thornadotrigger3073 2 ปีที่แล้ว +1

    this game can run on Windows 10 ?

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      Yes, this is written in Java. it can run on all systems. Including Windows, MacOS, Linux and much more.

  • @releNtless-eu3xc
    @releNtless-eu3xc 3 ปีที่แล้ว

    I have red line below my dy, ghost and int words? why is that? I types exactly like yours!

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Compare your code with the one on GitHub. Sometimes only one character is different. github.com/Gaspared/Pacman

  • @oliverbubniak5257
    @oliverbubniak5257 3 ปีที่แล้ว

    Hey man, can I ask? I trying to make custom background like image, but my problem is that I cant get to work only with AlphaComposite I can do something..but its not working properly..any ideas please ?:) Thanks

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      I don't have the Pacman code running on my PC right now for some reason. Did you try to set a background graphic as JPanel or JFrame? Or stackoverflow.com/questions/523767/how-to-set-background-image-in-java

    • @oliverbubniak5257
      @oliverbubniak5257 3 ปีที่แล้ว

      @@gasparcoding yes, I could get background to work but, if I see background, I couldnt see maze :/..so just use alpha for opacity..but makes everything opaque

  • @diegoantoniocanalesdelaros8825
    @diegoantoniocanalesdelaros8825 ปีที่แล้ว

    Where did you get the images from?

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      Its all on my github: github.com/Gaspared/Pacman/tree/master/images

  • @shadi9424
    @shadi9424 4 ปีที่แล้ว

    Amazing. is that programmable with javafx?

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว +1

      Yes, definitely. I made this one in Java, because it is easier and shorter. And JavaFX has become a bit more complicated to set up.
      But you could do this Pacman in JavaFX as well. I will also make JavaFX videos again.

    • @remi19999
      @remi19999 4 ปีที่แล้ว

      gaspar coding do you know any source i can find pacman programmed with java fx?

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว +1

      @@remi19999 Hey hitch space,
      I haven't made a Pacman in JavaFX myself, but GitHub is usually a good source for such projects. For example this one: github.com/jbaskauf/pacman

    • @remi19999
      @remi19999 4 ปีที่แล้ว +1

      @@gasparcoding yes i saw it, thank you so much for replying and your video it will help a lot in my course project

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว

      @@remi19999 Thank you! I wish you much success with your project :)

  • @releNtless-eu3xc
    @releNtless-eu3xc 3 ปีที่แล้ว

    how come the eclipse doesn't let me to run the program at all, its saying is unable to launch. not because it has error!

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      You seem to have made some progress. Check every character of your code with the one from GitHub

  • @monkeyboy4492
    @monkeyboy4492 3 ปีที่แล้ว +1

    I’m confused how you got the images into the project. Please help me?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      Probably because you have to change to the absolute path to the images. If you use Windows it looks like this: "C:\pic\pac.gif".
      If everything else works, this is often the problem. I use Linux and relative paths in the video.
      You can check the code again on GitHub: github.com/Gaspared/Pacman good luck! :)

    • @monkeyboy4492
      @monkeyboy4492 3 ปีที่แล้ว +1

      @@gasparcodingOkay thanks.

  • @majone1231
    @majone1231 3 ปีที่แล้ว

    Hello. I am a beginner. How much do I need to know about arrays?

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Not so many arrays are used, however more advanced Java techniques. Level Data is in a simple short array. You can have a look at the code beforehand on GitHub. In the video I explain one thing I do. github.com/Gaspared/Pacman/blob/master/Model.java
      Have fun and success! :)

  • @nhatlong7326
    @nhatlong7326 3 ปีที่แล้ว

    thanks 4 your guide but can i ask u why the dot and all the following is 16 0 1 2 4 8 ? Im newb

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      The drawMaze() method draws the maze out of the numbers in the screenData array. Number 1 is a left border, 2 is a top border, 4 is a right border, 8 is a bottom border and 16 is a point. We simply go through all 225 squares in the maze. For example we have 9 in the screenData array. We have the first bit (1) and the fourth bit (8) set. So we draw a bottom and a left border on this particular square. You have to add the numbers together. The numbers themselves are randomly chosen before. Which number stands for what.

  • @ryanli2571
    @ryanli2571 2 ปีที่แล้ว

    what did you use for editor?

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      It is eclipse, but any other ide will work

  • @ghostentertainment0568
    @ghostentertainment0568 ปีที่แล้ว

    Can I Use Notepad++ To Create such game?!

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      J also works with notepad th-cam.com/video/JIzMV6qk8Tg/w-d-xo.html

  • @israelfridman1742
    @israelfridman1742 3 ปีที่แล้ว

    thank you Learned alot!

  • @gostartgostart9645
    @gostartgostart9645 3 ปีที่แล้ว +1

    nice JOB MAN

  • @punyakoti9122
    @punyakoti9122 3 ปีที่แล้ว

    Can I have a video of Pacman on JavaFX?

  • @andresfeliperubianosantama2558
    @andresfeliperubianosantama2558 4 ปีที่แล้ว

    Hi! How can I make pacman move only one place at a time?
    Thank you very much!

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว

      Hey Andres, to change the speed of pacman you can adjust the variable "PACMAN_SPEED = 6;" in line 23: github.com/Gaspared/Pacman/blob/master/Model.java
      The movement of Pacman is controlled in the function that starts at line 246. The whole game is redrawn with the timer using screenData[pos]. The whole array is traversed, it is not intended that only one field is redrawn. The X and Y position of Pacman is updated with the variables pacmand_x = req_dx; and pacmand_y = req_dy;. Line 265. Therefore the Pacman runs further and further in the new direction that was pressed. But the problem is the timer, because it continues the movement based on the array. Of course all this is possible, but I think you would have to rebuild the game with different approaches.

  • @YoyellDCube
    @YoyellDCube 3 ปีที่แล้ว

    What app do you use??

    • @YoyellDCube
      @YoyellDCube 3 ปีที่แล้ว

      And How can I downloaded it

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@YoyellDCube I do all my Java tutorials with Eclipse: th-cam.com/video/8Qm6ll7fpSw/w-d-xo.html

  • @danhmaicong9521
    @danhmaicong9521 4 ปีที่แล้ว

    Do you update the screen by render and clear?

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว

      Hey, I use the timer function and let Graphics2D draw the single objects. It is checked what is in the varibale screenData or levelData. You can check the whole code on Github:
      github.com/Gaspared/Pacman/blob/master/Model.java

    • @danhmaicong9521
      @danhmaicong9521 4 ปีที่แล้ว

      @@gasparcoding thank u bro !

  • @jadeparangan4313
    @jadeparangan4313 ปีที่แล้ว

    Where will i get the imageicons?

    • @gasparcoding
      @gasparcoding  ปีที่แล้ว

      You can find the code on my Github, there are also the images in a folder ! :) github.com/Gaspared/Pacman

  • @Joombiful
    @Joombiful 3 ปีที่แล้ว

    noice work chief

  • @gesimneilconstantino4724
    @gesimneilconstantino4724 6 หลายเดือนก่อน

    We have a code?

  • @mennnoo8719
    @mennnoo8719 4 ปีที่แล้ว +2

    Are you German?

    • @gasparcoding
      @gasparcoding  4 ปีที่แล้ว +1

      Yes, I can't hide my German accent ;) My last video about the PHP Framework Symfony I made in german with english subtitles.

  • @khanhnguyenduc3317
    @khanhnguyenduc3317 3 ปีที่แล้ว

    Hello, I am coding the game in Java as your video. However, the screen does not appear as it is in your video. Could you help me to see the problem? (Could you let me know your email, I can send the code to you)

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      Hey Khanh Nguyen Duc, sometimes just a small typo is enough and the whole code stops working. Be sure to check your code against the code on Github. The code on Github works. Also make sure you have set up the module infos files and so on. github.com/Gaspared/pacman

    • @khanhnguyenduc3317
      @khanhnguyenduc3317 3 ปีที่แล้ว

      @@gasparcoding Thank you so much! I have checked the code. It has a bit different in the code on the videos. I have another question: In the line, for example - down = new ImageIcon("down.gif").getImage(); How do I write the link of the image like "down.gif"? I put the images (up, down, left, right, ghost, Pacman, heart) in the same folder but it disappears on the screen.
      Thank you for your answer!

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@khanhnguyenduc3317 You probably need to give the absolute path to your file on Windows. For example 'c:/Image/IMG.gif'.
      It depends on where your program can access. It is always a bit different depending on the operating system. Images are always a bit tricky.

  • @dnkyiv4731
    @dnkyiv4731 3 ปีที่แล้ว +1

    danke!

  • @lilmet6474
    @lilmet6474 2 ปีที่แล้ว

    I thik u need to comment explain what u r doing

    • @gasparcoding
      @gasparcoding  2 ปีที่แล้ว

      you can find more explanations here: zetcode.com/javagames/pacman/

  • @tbhidk255
    @tbhidk255 3 ปีที่แล้ว

    oh ein deutscher :D

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว +1

      Man merkt den Akzent 200 Meter gegen den Wind ;)

    • @tbhidk255
      @tbhidk255 3 ปีที่แล้ว +1

      @@gasparcoding musste so lachen als ichs direkt gehört habe 😂😂
      Aber echt geiler code
      Schaue mir gerade den ersten Part an und code mit

    • @gasparcoding
      @gasparcoding  3 ปีที่แล้ว

      @@tbhidk255 😀👍 du kannst dir den Code dazu auch zum Vergleich von GitHub laden. github.com/Gaspared/Pacman viel Erfolg 💻

    • @tbhidk255
      @tbhidk255 3 ปีที่แล้ว

      @@gasparcoding irgendwie funktioniert das bei mir nicht
      Ich hab das Herz-Png und die Gifs erst später eingefügt, weil es mir erst dann aufgefallen ist
      Aber irgendwie lässt das spiel sich net starten wenn ich auf space drücke

    • @tbhidk255
      @tbhidk255 3 ปีที่แล้ว

      @@gasparcoding falls du nochmal antworten solltest, brauchst du nicht mehr :D es lag an den adminstartorenrechten

  • @tetjeduwe8739
    @tetjeduwe8739 11 หลายเดือนก่อน

    red doch gleich deutsch