// Source File Name: Seafox.java
import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.*;
import java.util.Random;
public class Seafox extends Applet //采用Runnable多线程接口
implements Runnable {
int m_nKeyBuffer[];
Thread m_threadAnim;
boolean m_bInitialized;
static Random m_random = new Random();
public static int m_nMouseX;
public static int m_nMouseY;
public static boolean m_bMouseInWindow; //定义控制按钮
public static boolean m_bButtonDown;
public static boolean m_bSpacebarPressed;
final int m_nHistoryFrames = 10;
public static int m_nFrameNumber;
long m_lTime[];
public static long m_lLatestTime;
public static double m_dSecondsPerFrame;
MediaTracker m_mediaTracker;
Image m_imageLoading;
public static int m_nWindowWidth;
public static int m_nWindowHeight;
public static int m_nPlayfieldWidth;
public static int m_nPlayfieldHeight;
public static Font m_fontScorePopup = new Font("Helvetica", 1, 24);
public static final int SURFACE_HEIGHT = 60;
public static final Color SURFACE_COLOR = new Color(0, 0, 128);
public static final Color UNDERWATER_COLOR = new Color(0, 0, 64);
Image m_bufferPlayfield;
Image m_bufferSurface;
Image m_imageWater;
boolean m_bSoundEffectsOn;
AudioClip m_acBigExplosion;
AudioClip m_acLittleExplosion;
AudioClip m_acFireTorpedo;
AudioClip m_acOutOfTorpedoes;
AudioClip m_acClank;
AudioClip m_acSupplies;
AudioClip m_acShark;
AudioClip m_acSplash;
public static boolean m_bPlayBigExplosion;
public static boolean m_bPlayLittleExplosion;
public static boolean m_bPlayFireTorpedo;
public static boolean m_bPlayOutOfTorpedoes;
public static boolean m_bPlayClank;
public static boolean m_bPlaySupplies;
public static boolean m_bPlayShark;
public static boolean m_bPlaySplash;
public static final int SCOREBAR_HEIGHT = 20;
static final int SCOREBAR_BASELINE = 16;
static final int SCOREBAR_FONT_SIZE = 14;
static final int SCOREBAR_X_MARGIN = 4;
static final int SCOREBAR_ZONES = 5;
static final int SCOREBAR_MISSION_ZONE = 0;
static final int SCOREBAR_SHIPS_SUNK_ZONE = 1;
static final int SCOREBAR_SCORE_ZONE = 2;
static final int SCOREBAR_TORPEDO_ZONE = 3;
static final int SCOREBAR_FUEL_ZONE = 4;
static final Color SCOREBAR_BACKGROUND_COLOR = new Color(0, 43, 128);
static final Color SCOREBAR_CAPTION_COLOR = new Color(48, 128, 255);
static final Color SCOREBAR_VALUE_COLOR = new Color(149, 184, 255);
Image m_bufferScorebar;
Font m_fontScorebar;
int m_nScorebarZoneCaptionWidth[];
int m_nScorebarZoneDataX[];
int m_nScorebarZoneDataWidth[];
int m_nScorebarZoneValue[];
public static Player m_player = new Player(); // 定义类变量
public static VerticalTorpedo m_verticalTorpedo = new VerticalTorpedo();
public static HorizontalTorpedo m_horizontalTorpedo = new HorizontalTorpedo();
public static CapitalShip m_capitalShip[] = new CapitalShip[10];
public static HospitalShip m_hospitalShip[] = new HospitalShip[3];
public static Destroyer m_destroyer[] = new Destroyer[3];
public static DepthCharge m_depthCharge[] = new DepthCharge[3];
public static EnemySub m_enemySub[] = new EnemySub[3];
public static EnemyTorpedo m_enemyTorpedo[] = new EnemyTorpedo[3];
public static MagneticMine m_magneticMine[] = new MagneticMine[3];
public static SupplySub m_supplySub = new SupplySub();
public static Dolphin m_dolphin = new Dolphin();
public static Package m_package = new Package();
public static KillerFish m_killerFish = new KillerFish();
public static int m_nScore;
public static int m_nMission = 1;
public static int m_nSubsLeft = 3;
public static int m_nTimesPlayed;
public static boolean m_bMissionComplete;
public static boolean m_bDisplayMissionTitle;
public static boolean m_bGameOver;
Font m_fontMessage;
Color m_colorMessage;
String m_stringStart;
int m_nXstartString;
int m_nYstartString;
String m_stringOutOfFuel;
int m_nXoutOfFuel;
int m_nYoutOfFuel;
String m_stringGameOver;
int m_nXgameOver;
int m_nYgameOver;
String m_stringMissionTitle;
int m_nXmissionTitle;
int m_nYmissionTitle;
String m_stringMissionComplete;
int m_nXmissionComplete;
int m_nYmissionComplete;
String m_stringSubsLeft[];
int m_nXsubsLeft[];
int m_nYsubsLeft;
private void MissionInit() { //发射初始化
CapitalShip.m_nShipsSunk = 0;
int i = 0;
do { //随机确定商船位置
m_capitalShip[i].m_ndxImage = (m_random.nextInt() & 0x7fffffff) % 4;
m_capitalShip[i].m_nStatus = 0;
m_capitalShip[i].m_bSinkable = false;
m_capitalShip[i].m_dXoffset = ((double)i + 0.69999999999999996D * (m_random.nextDouble() - 0.5D)) * (double)CapitalShip.m_nXspacing;
} while(++i < 10);
i = 0;
do //随机确定救护位置
m_hospitalShip[i].m_dXoffset = ((double)i + 0.69999999999999996D * (m_random.nextDouble() - 0.5D)) * (double)HospitalShip.m_nXspacing;
while(++i < 3);
switch(m_nMission) {
case 1: // '\001'
Destroyer.m_nShipLimit = 0;
DepthCharge.m_nChargeLimit = 0;
EnemySub.m_nSubLimit = 0;
EnemyTorpedo.m_nTorpedoLimit = 0;
MagneticMine.m_nMineLimit = 0;
break;
case 2: // '\002'
Destroyer.m_nShipLimit = 3;
DepthCharge.m_nChargeLimit = 3;
EnemySub.m_nSubLimit = 0;
EnemyTorpedo.m_nTorpedoLimit = 0;
MagneticMine.m_nMineLimit = 0;
break;
case 3: // '\003'
Destroyer.m_nShipLimit = 3;
DepthCharge.m_nChargeLimit = 3;
EnemySub.m_nSubLimit = 3;
EnemyTorpedo.m_nTorpedoLimit = 0;
MagneticMine.m_nMineLimit = 0;
break;
case 4: // '\004'
Destroyer.m_nShipLimit = 3;
DepthCharge.m_nChargeLimit = 3;
EnemySub.m_nSubLimit = 3;
EnemyTorpedo.m_nTorpedoLimit = 3;
MagneticMine.m_nMineLimit = 0;
break;
case 5: // '\005'
Destroyer.m_nShipLimit = 3;
DepthCharge.m_nChargeLimit = 3;
EnemySub.m_nSubLimit = 3;
EnemyTorpedo.m_nTorpedoLimit = 3;
MagneticMine.m_nMineLimit = 3;
break;
}
m_stringMissionTitle = new String("Mission " + m_nMission);
m_bDisplayMissionTitle = true;
}
public void start() { //启动线程
if(m_threadAnim == null) {
m_threadAnim = new Thread(this);
m_threadAnim.start();
}
}
public void stop() { //终止线程
if(m_threadAnim != null) {
m_threadAnim.stop();
m_threadAnim = null;
}
}
public boolean keyUp(Event event, int i) {
if(i == 32)
m_bSpacebarPressed = false;
return true;
}
public boolean mouseExit(Event event, int i, int j) {
m_nMouseX = i;
m_nMouseY = j;
m_bMouseInWindow = false;
m_bButtonDown = false;
return true;
}
public boolean mouseMove(Event event, int i, int j) {
m_nMouseX = i;
m_nMouseY = j;
m_bMouseInWindow = true;
m_bButtonDown = false;
return true;
}
public Seafox() { //构造方法
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
潜艇打商船.rar (89个子文件)
潜艇打商船
submarine
lt_wake3.gif 827B
DepthCharge.class 5KB
dn_wake3.gif 821B
dcblast3.gif 3KB
vtblast3.gif 1KB
klr_fsh0.gif 2KB
splash.au 8KB
mag_mine.gif 956B
et_wake1.gif 821B
dn_wake1.gif 821B
rt_wake3.gif 826B
Dolphin.class 2KB
et_wake3.gif 821B
Player.class 6KB
fire.au 10KB
MagneticMine.class 4KB
lt_wake0.gif 827B
capship3.gif 927B
capship2.gif 1017B
dn_wake2.gif 819B
enemytor.gif 851B
csblast3.gif 2KB
dn_wake0.gif 821B
splash2.gif 859B
cs_sink0.gif 979B
up_wake0.gif 819B
cs_sink2.gif 887B
CapitalShip.class 3KB
csblast2.gif 2KB
submarine.html 606B
KillerFish.class 1KB
dolphin1.gif 938B
splash1.gif 871B
up_wake2.gif 819B
splash3.gif 845B
up_wake3.gif 821B
dolphin2.gif 945B
dcblast2.gif 2KB
csblast0.gif 1KB
splash0.gif 863B
vtblast2.gif 1KB
dolphin3.gif 967B
cs_sink1.gif 938B
SupplySub.class 3KB
ltl_expl.au 9KB
utorpedo.gif 851B
cs_sink3.gif 844B
EnemyTorpedo.class 3KB
up_wake1.gif 821B
sply_sub.gif 1KB
water.gif 3KB
et_wake0.gif 821B
Destroyer.class 4KB
enemysub.gif 1023B
Seafox.class 21KB
dcblast1.gif 1KB
dcblast0.gif 1KB
submarine.jpg 93KB
lt_wake1.gif 826B
HorizontalTorpedo.class 4KB
capship1.gif 954B
htorpedo.gif 851B
capship0.gif 961B
package.gif 838B
big_expl.au 18KB
EnemySub.class 5KB
shark.au 22KB
rt_wake1.gif 827B
supplies.au 3KB
lt_wake2.gif 827B
dtorpedo.gif 851B
dolphin0.gif 957B
VerticalTorpedo.class 5KB
Package.class 2KB
vtblast1.gif 1KB
rt_wake0.gif 827B
hospship.gif 965B
submarinejdk.jpg 44KB
et_wake2.gif 819B
destroyr.gif 979B
logo1.gif 2KB
csblast1.gif 2KB
vtblast0.gif 1KB
HospitalShip.class 2KB
clank.au 2KB
plr_sub.gif 1KB
Seafox.java 121KB
empty.au 930B
rt_wake2.gif 827B
共 89 条
- 1
资源评论
- zz4alex2013-05-21有点乱,代码不是很可读!
- hjhjw19912012-04-27源码通俗,注释也够,不过命名不够规范,而且不知道是不是我的原因只能玩第一关。
xxx_xiao
- 粉丝: 1
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功