Java Game Programming for Beginners - #3 - Double Buffering
Uploader Comments (TheJavaHub)
All Comments (37)
-
OMG it works perfect! Ive been learning java for a few days and workin on my side scroller was really trouble until i saw this! I <3 you man, no homo. hahah :) Thanks!
-
OK, now it is fine. It seems like it had some problems with jre6, what do you think it could be ?
-
I work in eclipse and did everything like you did, I hava the same number of warnings on keys like you, but it won't run, it says in the console: java.lang.NoSuchMethodError: main
-
@TheJavaHub this is a somewhat better explanation because I'm having trouble interpreting the changes to the image line by line in the code. It would be cool if there was a step-by-step visual explanation to what's going on as the loop happens
-
for some reason the program dose not even start
-
Anyone know how to work with a gui in netbeans? how would you make say a character move across the screen with this code?
-
i m getting an error in this:
public void paint(Graphics g) { dbimage = createImage(getWidth(), getHeight()); dbg = dbimage.getGraphics(); paintComponent(dbg); g.drawImage(dbg, 0, 0, this); }
the g.drawImage(dbg, 0, 0, this); encounters an error, that is:
"The method drawImage(Image, int, int, ImageObserver) in the type Graphics is not applicable for the arguments (Graphics, int, int, javaGame)"
-
thanks a lot for this tutorial it helped a lot! :-)
I don't get the usage of Public and Private, In the video you declared dbImage to be private.As far as I understand it doesn't matter unless you are going to access it from another class.So my question is why not to declare every thing as public?
Mrkirill578 1 month ago in playlist Beginner Java Game Programming
@Mrkirill578 'private' means that you cannot access the variable/method/class from outside the class it is within. This is to protect the variables from unwanted changes. 'public' allows the variable/method/class to be accessed from anywhere outside the class it is within. The reason we use private for the dbImage and dbg is because if it were to be modified from a different Thread, for example, the program would crash.
TheJavaHub 1 month ago
(-_-)
TarbleSs1 3 months ago
@TarbleSs1 ???
TheJavaHub 3 months ago
Double buffering is so confusing for me :( I understand when you talk about it and show it.. but doing it myself is so much harder >_<.
CriticaLKonflict 5 months ago
@TheJavaHub @CriticaLKonflict ways in this video. Double buffering works because instead of deleting the entire image and then repainting it, we 'pre-load' the next image off the screen and then paint it directly to it. This prevents the annoying flickering.
Hope this helps :)
TheJavaHub 5 months ago