91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 95KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-11
  • 語言: Java
  • 標(biāo)簽: 吃豆子??

資源簡介

一個(gè)java的吃豆子小游戲 需要的可以來下載

資源截圖

代碼片段和文件信息

import?java.awt.*;

/**
?*?定義敵人的類
?*/
public?class?Enemy{
private?int?xPos;
private?int?yPos;
private?int?xVPos;
private?int?yVPos;
private?int?direction;

//敵人是否失去反抗能力
private?boolean?alarm;
//敵人失去防抗能力的時(shí)間
private?int?alarmTime;
private?boolean?ghostMode;
private?Rectangle?Enemy;
private?int?speed;
private?int?interval;
private?int?Colour;
private?int?AI_time1?AI_time2;
private?int?lefttime?uptime?righttime?downtime;
private?int?gameFlow;
private?boolean?ghost;
private?boolean?canMoveUp?canMoveDown?canMoveLeftcanMoveRight;
private?boolean?cantGoAnyWhere;
private?int?prisonTime;
private?boolean?stop;

/**
?**根據(jù)x、y、顏色、是否已經(jīng)出牢籠、剩余多長時(shí)間才可出牢籠
?**構(gòu)造敵人對(duì)象
?*/
public?Enemy(int?a?int?b?int?c?boolean?cantGoAnyWhere?int?prisonTime){
xPos?=?a;
yPos?=?b;
xVPos?=?xPos;
yVPos?=?yVPos;
direction?=?3;
speed?=?3;
interval?=?63?+?21*((int)(Math.random()*10));
AI_time1?=?0;
Colour?=?c;
this.prisonTime?=?prisonTime;
this.cantGoAnyWhere?=?cantGoAnyWhere;
Enemy?=?new?Rectangle(xPos?-10?yPos?-?10?21?21);
}

/**
?**方法:敵人的移動(dòng)
?*/
public?void?move(int?a?int?b?Wall[]?wall){
AI_time1++;
AI_time2++;
uptime++;
downtime++;
lefttime++;
righttime++;
gameFlow++;

//如果敵人沒有反抗能力
if(alarm)
alarmTime++;
boolean?changeMovement?=?false;

//如果敵人不能移動(dòng),就將囚禁得時(shí)間不停增加
if(cantGoAnyWhere)
prisonTime++;

//當(dāng)敵人失去反抗能力后,速度降低
if(alarm)
speed?=?1;
else
speed?=?2;

//失去反抗能力到指定時(shí)間后,恢復(fù)原態(tài)
if(alarmTime?>=?330){
alarmTime?=?0;
alarm?=?false;
}


canMoveUp?=?true;
canMoveDown?=?true;
canMoveLeft?=?true;
canMoveRight?=?true;

Rectangle?R;
Rectangle?UP?=?new?Rectangle(xVPos?-?10?yVPos?-?10?-?speed?21?21);
Rectangle?DOWN?=?new?Rectangle(xVPos?-?10?yVPos?-?10?+?speed?21?21);
Rectangle?LEFT?=?new?Rectangle(xVPos?-?10?-?speed?yVPos?-?10?21?21);
Rectangle?RIGHT?=?new?Rectangle(xVPos?-?10?+?speed?yVPos?-?10?21?21);

for(int?i?=?0;?i? R?=?new?Rectangle(wall[i].getxPos()?-?10?wall[i].getyPos()?-?10?21?21);
if(R.intersects(UP))
canMoveUp?=?false;
if(prisonTime? //確定此?Rectangle?R是否與指定?Rectangle?UP?相交。如果兩個(gè)矩形的交集為非空,則它們是相交的。?
//如果R與UP相交,則返回?true;否則返回?false。
if(R.intersects(UP)?&&?direction?==?0){
yPos?=?yVPos;
changeMovement?=?true;
}
}

if(!(ghost?&&?(yVPos?>=?189?&&?yVPos? if(R.intersects(DOWN))
canMoveDown?=?false;
if(R.intersects(DOWN)?&&?direction?==?1){
yPos?=?yVPos;
changeMovement?=?true;
}
}

if(R.intersects(LEFT))
canMoveLeft?=?false;
if(R.intersects(LEFT)?&&?direction?==?2){
xPos?=?xVPos;
changeMovement?=?true;
}

if(R.intersects(RIGHT))
canMoveRight?=?false;
if(R.intersects(RIGHT)?&&?direction?==?3){
xPos?=?xVPos;
changeMovement?=?true;
}
}

interval-=speed;

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????13753??2006-03-27?23:02??源程序\Enemy.java

?????文件???????4300??2006-03-20?23:22??源程序\Fruit.java

?????文件????????815??2006-03-27?19:22??源程序\Gold.java

?????文件??????37376??2006-10-18?09:51??源程序\Image\Thumbs.db

?????文件????????354??2003-07-04?04:50??源程序\Image\wall1.jpg

?????文件????????380??2003-07-04?04:50??源程序\Image\wall10.jpg

?????文件????????415??2003-07-04?04:50??源程序\Image\wall11.jpg

?????文件????????382??2003-07-04?04:50??源程序\Image\wall12.jpg

?????文件????????398??2003-07-04?04:50??源程序\Image\wall13.jpg

?????文件????????397??2003-07-04?04:50??源程序\Image\wall14.jpg

?????文件????????383??2003-07-04?04:50??源程序\Image\wall15.jpg

?????文件????????334??2003-07-04?04:50??源程序\Image\wall16.jpg

?????文件????????329??2003-07-04?04:50??源程序\Image\wall17.jpg

?????文件????????316??2003-07-04?04:50??源程序\Image\wall18.jpg

?????文件????????316??2003-07-04?04:50??源程序\Image\wall19.jpg

?????文件????????356??2003-07-04?04:50??源程序\Image\wall2.jpg

?????文件????????405??2003-07-04?04:50??源程序\Image\wall20.jpg

?????文件????????409??2003-07-04?04:50??源程序\Image\wall21.jpg

?????文件????????414??2003-07-04?04:50??源程序\Image\wall22.jpg

?????文件????????407??2003-07-04?04:50??源程序\Image\wall23.jpg

?????文件????????377??2003-07-04?04:50??源程序\Image\wall24.jpg

?????文件????????372??2003-07-04?04:50??源程序\Image\wall25.jpg

?????文件????????366??2003-07-04?04:50??源程序\Image\wall26.jpg

?????文件????????370??2003-07-04?04:50??源程序\Image\wall27.jpg

?????文件????????422??2003-07-04?04:50??源程序\Image\wall28.jpg

?????文件????????430??2003-07-04?04:50??源程序\Image\wall29.jpg

?????文件????????411??2003-07-04?04:50??源程序\Image\wall3.jpg

?????文件????????424??2003-07-04?04:50??源程序\Image\wall30.jpg

?????文件????????402??2003-07-04?04:50??源程序\Image\wall31.jpg

?????文件????????362??2003-07-04?04:50??源程序\Image\wall32.jpg

............此處省略40個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源