"Sixth Week" "New Bee Station" 2

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.