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! :)
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 ?
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! :)
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
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
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.........
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 ;)
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 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/
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.
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?
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
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
@@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! :)
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.
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 ?
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! :)
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
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!
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 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! :)
@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
@@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
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
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?
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. :)
@@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?
@@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?
@@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
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
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
@@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
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 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
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! :)
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! :)
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.
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.
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
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)
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
@@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!
@@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.
@@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
I wish I found it earlier.But I have my exams now and I have to study for them too.
Good luck with your exams. Come back when you are ready :)
@@gasparcoding Thanks a lot. I'll surely come here after a month
How would i code this if I did not want to use packages
Hope you get at least a 100K subscribers dude. You are awesome.
Thank you very much :D
Thank you for this fascinating video! Could you explain how to change the coordinates in levelData[] , if I want to draw a new field?
This is amazing. Thank you for your effort.
Thank you so much sina! This is a great motivation ☺️
Thank you very much for this videos. It is really helpful for me on my studies. Can I have a source code?
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! :)
he literally coded it infront of u wtf do u mean
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 ?
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! :)
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
@@theoroschke7071 Top! Super das du die Probleme schon selbst lösen konntest! :) Dabei lernt man immer am meisten über die Sprache! ;)
Dude thanks for this.. you've got a new subscriber here ☺️
Thank you so much. I am glad to have you on board! 😃
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
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
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.........
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 ;)
Ok I will compare it........thank you very much :)
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?
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
I dont know how i make the Pictures of my Pacman and of the Ghosts
Can you Help me
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!
@@gasparcoding yes, i have done this but it didnt Work , i dont know why
@@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/
17:13 hi! what you mean when you type "dx = -dx;"? My compiler says:
"Operator '-' cannot be applied to 'int[]' "
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.
how do i resize it
every time i costumize the dimension and the panel there's a lot of glitches happen
can i used that same code in android studio rather than in eclipse
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?
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.
@@gasparcoding thank you i realised i made a mistake :)
@@luc1537 perfect. Happy Coding! :)
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......
Does the happen every time, after restart etc? The code is on Github github.com/Gaspared/Pacman
I cross checked it's not working
The assets aren't visible
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?
I have a question Can somebody/I programm an other map sure right?
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
dude my game is not starting only i am pressing space bar but nothing is happing pls tell what to do
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
Hey, did it work? I’m having the same problem
Such an amazing video bro love it totally!
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?
Alright, I found out :)
@@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! :)
@@gasparcoding Thank you so much :)
How did u instant put the numbers on bottom of leve data?
bro can i ask i made it but pacman is no where to be found
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.
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 ?
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! :)
Thanks a lot for your answer.
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
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!
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.
Are u using javafx for this project?
@@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! :)
@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
@@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
hey, you're great! Can you please tell me what unit tests can be created for the application?
JUnit should provide everything you need :)
www.vogella.com/tutorials/JUnit/article.html
Are any AI based algorithms used in this project???...if yes what are they??
No, there is no AI. Just plain Java :)
my images dont seem to work.. and i dont know what im doing wrong. how can i fix this?
Did u check the code on githib? github.com/Gaspared/Pacman On windows u have to use differnet slahs /\ 🙂
bro i lost at 12:30 there's an error when I put "40, this" at timer. how to fix this? please reply
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! :)
You have to add in the import section import javax.swing.Timer;
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
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
Hey, did it work, I’m having the same problem
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?
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. :)
@@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?
@@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?
@@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
Hello?
I will have a question for you. What program do you use?
I use java in eclipse. I recently made a video about how to install it. th-cam.com/video/8Qm6ll7fpSw/w-d-xo.html
@@gasparcoding Thank you so much ❤️
this game can run on Windows 10 ?
Yes, this is written in Java. it can run on all systems. Including Windows, MacOS, Linux and much more.
I have red line below my dy, ghost and int words? why is that? I types exactly like yours!
Compare your code with the one on GitHub. Sometimes only one character is different. github.com/Gaspared/Pacman
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
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
@@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
Where did you get the images from?
Its all on my github: github.com/Gaspared/Pacman/tree/master/images
Amazing. is that programmable with javafx?
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.
gaspar coding do you know any source i can find pacman programmed with java fx?
@@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
@@gasparcoding yes i saw it, thank you so much for replying and your video it will help a lot in my course project
@@remi19999 Thank you! I wish you much success with your project :)
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!
You seem to have made some progress. Check every character of your code with the one from GitHub
I’m confused how you got the images into the project. Please help me?
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! :)
@@gasparcodingOkay thanks.
Hello. I am a beginner. How much do I need to know about arrays?
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! :)
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
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.
what did you use for editor?
It is eclipse, but any other ide will work
Can I Use Notepad++ To Create such game?!
J also works with notepad th-cam.com/video/JIzMV6qk8Tg/w-d-xo.html
thank you Learned alot!
glad to hear it :)
nice JOB MAN
Can I have a video of Pacman on JavaFX?
Hi! How can I make pacman move only one place at a time?
Thank you very much!
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.
What app do you use??
And How can I downloaded it
@@YoyellDCube I do all my Java tutorials with Eclipse: th-cam.com/video/8Qm6ll7fpSw/w-d-xo.html
Do you update the screen by render and clear?
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
@@gasparcoding thank u bro !
Where will i get the imageicons?
You can find the code on my Github, there are also the images in a folder ! :) github.com/Gaspared/Pacman
noice work chief
We have a code?
Are you German?
Yes, I can't hide my German accent ;) My last video about the PHP Framework Symfony I made in german with english subtitles.
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)
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
@@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!
@@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.
danke!
Bitte 😌
I thik u need to comment explain what u r doing
you can find more explanations here: zetcode.com/javagames/pacman/
oh ein deutscher :D
Man merkt den Akzent 200 Meter gegen den Wind ;)
@@gasparcoding musste so lachen als ichs direkt gehört habe 😂😂
Aber echt geiler code
Schaue mir gerade den ersten Part an und code mit
@@tbhidk255 😀👍 du kannst dir den Code dazu auch zum Vergleich von GitHub laden. github.com/Gaspared/Pacman viel Erfolg 💻
@@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
@@gasparcoding falls du nochmal antworten solltest, brauchst du nicht mehr :D es lag an den adminstartorenrechten
red doch gleich deutsch