用NetBeans开发J2ME游戏实例讲解(三)[5]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

        }

    }

   

    private boolean canMove( int direction ){

        nextCursor[0]=currentCursor[0];               

        nextCursor[1]=currentCursor[1];               

        nextCursor[2]=currentCursor[2];               

        nextCursor[3]=currentCursor[3];       

        switch (direction){

            case DIRECTION_UP:

                if (this.currentCursor[1] - 1 >= 0) {//向上还有移动空间

                    this.nextCursor[1]--;//向上移动一下

                    if (!setMoveRange()){ //不能移动

                        this.nextCursor[1]++;//退回来

                        return false;

                    }

                    else {

                        this.nextCursor[1]++;//退回来

                        return true;

                    }

                }

                else

                    return false;

            case DIRECTION_DOWN:

                if (this.currentCursor[1] + 1 < Images.HEIGHT) {//向下还有移动空间

                    this.nextCursor[1]++;//向下移动一下

                    if (!setMoveRange()){ //不能移动

                        this.nextCursor[1]--;//退回来

                        return false;

                    }

                    else {

                        this.nextCursor[1]--;//退回来

                        return true;

                    }

                }

                else

                    return false;

            case DIRECTION_LEFT:

                if (this.currentCursor[0] - 1 >= 0) {//向左还有移动空间

本文关键:用NetBeans开发J2ME游戏实例讲解(三)
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top