⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 squarebumper.java

📁 基于JAVA的跳球游戏
💻 JAVA
字号:
/*
 * SquareBumper.java
 *
 * Created on 2008年5月11日, 下午8:37
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package gizmos;
import java.awt.geom.*;
import java.awt.Color;
import java.awt.Graphics2D;
import gizmoball_demo.AnimationWindow;

/**
 *
 * @author ICE
 */
/**
    SquareBumper represents a mutable, square Gizmo. SquareBumpers reflect Balls from their surface but
    perform no action when they are triggered. A SquareBumper is centered at (x + 0.5L, y + 0.5L) and has
    corners at (x [+ 1L], y [+ 1L]).
 */

public class SquareBumper extends BasicGizmo{
    private Color color = new Color(0, 0, 255);
    private gizmoball_demo.AnimationWindow win;
    private int width = 20;
    /** Creates a new instance of SquareBumper */
    public SquareBumper(){}
    public SquareBumper(gizmoball_demo.AnimationWindow win,java.lang.String name,int x,int y) 
    {
        this.win = win;
        this.name=name;
        this.x=x;
        this.y=y;
      
    }
    //public boolean overlapsWith(Ball ball){}
    public void draw(java.awt.Graphics2D g)
    {
        Rectangle2D squareBumper = new Rectangle2D.Double(x,y,width,width);
        g.setColor(color);
        g.fill(squareBumper);
    }
    
    public int getDis(){
        return width/2;
    }
    //public org.w3c.dom.Element toXML(boolean compatible){}
    //public int pollScore(){}
    //public int popScore(){}
    
    
    
}

⌨️ 快捷键说明

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