A simple task to create game using LWJGL in OpenGL

A simple game to create using LWJGL in OpenGL

Create a little game in a file Ex2. j ava that behaves as follows.
At the start, data for a bunch of boxes (mono-colored, axis-aligned rectangles) should be read from a data file. The required data file format is to have the number of boxes on the first line, and then for that many boxes to have these numbers:
x and y coordinates of the lower left corner of the rectangle (doubles) width (in x direction) and height (in y direction) of the rectangle (doubles) red, green, and blue color levels (doubles from 0 to 1 inclusive)
To keep things simple, and to make boxes that are actually visible, remember that the “graph paper” we are UJjjng only goes from —1 to 1 in the x and y directions.
Here is a sample data that produces this picture:
file:
0 0
0.2 0.3
1 0 0
0.5 0.9
0.5 0.1
0 1 0
-0.5 -0.5 ?
0.1 0.1
0 0 1
with boxes, from left to right, that are blue, red, and green.
You should, of course, create a Box class and use an ArrayList variable to hold all this information.
The first box in the data file must be blue and should be the player box. The following boxes must be gray for walls, red for deadly things, and green for delicious things.
The player moves the blue box by pressing the arrow keys, with each press moving the blue box an appropriate small distance.
If the blue box touches a gray box, the blue box must be returned to where it was before it tried to move. If the blue box touches a green box, the green box should be removed from the scene, and if there are no more green boxes, the program should halt (the player has won). If the blue box touches a red box, the program should halt (the player has lost).

Leave a Reply

Your email address will not be published.