📄 explosion.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
public class Explosion
{
Form TankGame2008;
Image[] explFrameImage;
int explNum = 0;
int curX, curY;
bool visible;
public Explosion(Image[] explFrameImage, Form TankGame2008)
{
this.explFrameImage = explFrameImage;
this.TankGame2008 = TankGame2008;
this.visible = false;
this.curX = 0;
this.curY = 0;
}
public void setVisible(bool visible)
{
this.visible = visible;
}
public bool getVisible()
{
return this.visible;
}
/// <summary>
/// 当前爆炸效果的帧
/// </summary>
/// <returns></returns>
public int getExplNum()
{
return this.explNum;
}
/// <summary>
/// 爆炸效果总共的帧数
/// </summary>
/// <returns></returns>
public int getExplFrameNum()
{
return this.explFrameImage.Length;
}
public void updateState()
{
explNum += 1;
if (explNum > explFrameImage.Length-1)
{
this.setVisible(false);
explNum = 0;
}
}
public void setPos(int x, int y)
{
this.curX = x;
this.curY = y;
}
public void drawSprite(Graphics g)
{
if (this.visible == true)
{
g.DrawImage(explFrameImage[explNum], curX, curY, explFrameImage[explNum].Width, explFrameImage[explNum].Height);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -