Jan 21, 2012

Implement background thread for our game

Start reading here: Create a SurfaceView Game step-by-step

- Click to select our package (com.MyGame) in Package Explorer. Then click File of Eclipse, -> New -> Class


- Enter "MyGameThread" in the Name field, then click Browse... to select Superclass.


- Enter Thread in the search box to choice Thread - java.lang, then click OK.


- Then click Finish in the New Java Class dialog.

- In the Edit Windows (with MyGameThread.java), right click on any blank space, select Source -> Override/Implement Methods...


- Type "run" on In Override/Implement Methods dialog, it will search the matched method for you: the run() will be listed. Click to select run(), and click Ok.


- It's the basic of our Thread. We will add/modify more methods later.

No comments:

Post a Comment

Infolinks In Text Ads