goal.java

来自「DOJA平台赛车游戏」· Java 代码 · 共 59 行

JAVA
59
字号
/*
 * @(#)Goal.java    1.0 04/07/01 @(#)
 *
 * Copyright 2004 NTT DoCoMo, Inc. All rights reserved.
 */

/** 
 * Goal<BR>
 * The definition class of goal.
 * <p>
 * @version 1.0
 * </p>
 */
public class Goal extends AbstractItem {
    /** Validity of this object */
    private boolean enabled;
    /** The initial display position of this object */
    private int initPosX;
    

    /**
     * Constructor.
     * @param _leftEndOfCourse Coordinates at the left end of a course
     */
    public Goal(int _leftEndOfCourse) {
        super(TYPE_GOAL_LINE, MediaCollection.IMG_GOAL);
        initPosX = _leftEndOfCourse;
        setPosX(initPosX);
        setPosY(1);
        enabled = false;
    }

    /**
     * Gets the Validity of this object.
     * @return Validity
     */
    public boolean isEnabled() {
        return this.enabled;
    }

    /**
     * Changes the effective / non-effect of this object.
     * @param _enabled Effective:true
     */
    public void setEnabled(boolean _enabled) {
        if ((!this.enabled) && (_enabled)) {
            setPosX(initPosX);
            setPosY(1);
        }
        this.enabled = _enabled;
    }

    /*
     * @see AbstractItem#contact()
     */
    public void contact() {
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?