Http:https://git.coding.net/boxer_/homework.git
Ssh:[email Protected]:boxer_/homework.git
Group Name: New Bee
Group leader: Wu Zhiyuan
Group member: Gongchengrong Shei Willow Li Qiao
Project Name: Java Tetris
Station Time: 11.2
Total task
1, the database display module.
2, local record module,
3, Tetris main module
4, Button window module
5, Next window module
6, Level window module,
7, Fractional window module.
8, copyright information module.
Daily quests:
Implement the next window.
In fact, it is not difficult, with the previous work, randomly generated blocks is actually generated random numbers, and then based on the random number of images generated, and the next window is the first to save the random number, read and then used to generate the next line, and then generated in the main stage of the game. Main code:
1 Public StaticImage next[];2 Public StaticList<image>Bg_im;3 Static {4 //Initializes a picture of the next block5NEXT =Newimage[gameconfig.getsystem_config (). Gettypeconfig (). Size ();6 for(inti = 0; i < next.length; i++) {7Next[i] =NewImageIcon ("graphics/game/" + i + ". png"). GetImage ();8 }9 //Initialize background imageTen //1. Get the file (clip) object where the background image is located OneFile File =NewFile ("Graphics/background"); A //2. Get all sub-file objects under this folder -File files[] =file.listfiles (); -Bg_im =NewArraylist<image>(); the //3. Traverse the difference file to create a picture object with the eligible picture - for(File file2:files) { - //do not create objects if they are folders - if(File2.isdirectory ()) { + Continue; - } +Bg_im.add (NewImageIcon (File2.getpath ()). GetImage ()); A } at -}
After finding the picture, draw it out.
Public classLayernextextendsLayer { PublicLayernext (intXintYintWinth) {Super(x, Y, W, h); } /*** @Title: *@authorWzy * @Describe*/ Public voidPaint (Graphics g) { This. Creatwindow (g); //If you start the whole, then draw the next block if( This. Gamedto.isstart ()) { This. Drawimageatcenter (ima.next[ This. Gamedto.getnext ()], g); } }}
"Sixth Week" "New Bee Station" 2