Hero.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.lcdui.Image;
- import javax.microedition.lcdui.game.Sprite;
- public class Hero
- {
- private Image image;
- public Hero()
- {
- }
- public void load()
- {
- try
- {
- image = Image.createImage("/hero.png");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- public Sprite getHero()
- {
- Image tmp = null;
- try
- {
- tmp = Image.createImage(image, 0, 0, 72, 116, Sprite.TRANS_NONE);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- Sprite hero = new Sprite(tmp, 24, 29);
- return hero;
- }
- }