1 Star 0 Fork 78

陈纪康/asteroids

forked from 吕焱飞/asteroids 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ProtonWave.java 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
luyanfei78 提交于 2020-04-15 10:17 . asteroids initialized.
import greenfoot.*;
/**
* A proton wave that expands and destroys asteroids in its path.
*
* @author Michael Kölling
* @version 0.1
*/
public class ProtonWave extends Actor
{
/** The damage this wave will deal */
private static final int DAMAGE = 30;
/** How many images should be used in the animation of the wave */
private static final int NUMBER_IMAGES= 30;
/**
* The images of the wave. This is static so the images are not
* recreated for every object (improves performance significantly).
*/
private static GreenfootImage[] images;
/**
* Create a new proton wave.
*/
public ProtonWave()
{
initializeImages();
}
/**
* Create the images for expanding the wave.
*/
public static void initializeImages()
{
if(images == null)
{
GreenfootImage baseImage = new GreenfootImage("wave.png");
images = new GreenfootImage[NUMBER_IMAGES];
int i = 0;
while (i < NUMBER_IMAGES)
{
int size = (i+1) * ( baseImage.getWidth() / NUMBER_IMAGES );
images[i] = new GreenfootImage(baseImage);
images[i].scale(size, size);
i++;
}
}
}
/**
* Act for the proton wave is: grow and check whether we hit anything.
*/
public void act()
{
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ji_kang_chen/asteroids.git
git@gitee.com:ji_kang_chen/asteroids.git
ji_kang_chen
asteroids
asteroids
master

搜索帮助