Dream Game, RPG game open Source Development lectures (JAVA) [5]--a tree double flower __java

Source: Internet
Author: User

Continue, taking into account the future expansion of the need to start the code modular refactoring, the original Mypanel decomposed into Common,gamemap,gamehandle and Mypanel and other 4 modules, step-by-step sprite operation.

0-5 The source download address is as follows, has been packaged.

Http://www.3adisk.com/?onlinezero

File name: [Rpgchair]


or save this x GIF file as a RAR format.

As there is no change, do not say more, I continue to be depressed today, what all ignore, continue to be depressed ...

Common class :

 

package org.loon.chair.example5;

/**

*

* @author Chenpeng

* @email ceponline@yahoo.com.cn

*

* Loon Framework in Game

*

*/

Public Interface Common {

Here we add a set of constants to distinguish the triggering of the left and right buttons,

The reason why we use numbers to make a difference is that everyone is very clear ^ ^, digital

The efficiency of the operation is high ~

Public Static Final int left = 0;

Public Static Final int right = 1;

Public Static Final int up = 2;

Public Static Final int down = 3;

Single image size, I default to 32x32 graphics, can adjust the scale as needed.

At that time, always should be coordinated with the size of the form, such as 32x32 pictures, how to

Set 15 on one line, then 480, which is the default form size for this example,

Of course, we can also automatically adjust the initialization of the ROW*CS,COL*CS according to the

The size of the form will be used in a future example. In a word, programming

is [for the purpose of existence], all methods, everyone can try and use.

Public Static Final int CS = 32;

}

Gamemap class:

package org.loon.chair.example5;

import java.awt.Graphics;

import java.awt.Image;

import Javax.swing.ImageIcon;

/**

*

* @author Chenpeng

* @email ceponline@yahoo.com.cn

*

* Loon Framework in Game

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.