Simple Pong Game

+1 Ammar Zakaria · December 21, 2015
Thanks for the awesome videos. I'm currently trying to make a simple pong game for my grade 11 CS final project in java. I just need to know which of your videos I'll need to watch for learning graphics, especially on how to display an array onto the screen. Other than that, if there's anything else you think I'd need to know, please tell me.
Once again, thanks for the wonderful videos.

Post a Reply

Replies

Oldest  Newest  Rating
0 Nicholas Eason · December 25, 2015
I'm not sure if it's too late, but check out his java game development videos. He explains how to use BufferedImages. To use them in an array you just declare the array like any other object array.

BufferedImage imgs[] = new BufferedImage[numOfImgs];

//Populate Array


Umm, to display a BufferedImage, you can use

g.drawImage(imgs[imageNumber], x, y, null);
//As he states in one of the game development videos, Image Observers are complicated things,
//and unneeded for the thing you're trying to do.


In the end, it's not that complicated. However, I think you may just be better of using rectangles and coloring them a solid color... but hey, do it 
however you want to, as long as it works.
0 Ammar Zakaria · December 29, 2015
Thanks but how do you make the ball move around without using an array?
0 Nicholas Eason · January 1, 2016
To make the ball move around you just change the x and y position of the image while drawing it, specifically when drawing the image you dont want to hard-code x and y values because they're dynamic so just alter the variable appropriately.
  • 1

Java / Android Development

107,265 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator