① 写一个简单的java小游戏

刚刚帮人改了一个小代码游戏
地址是http://..com/question/160524457.html
是个互动小游戏,邮件就没发了。

② 用JAVA编一个小游戏

我也想学

教教我吧

我是手游忠实的爱好者

有什么游戏我也可以试玩哦

③ 用JAVA编写一个小游戏

前天写的猜数字游戏,yongi控制猜测次数,有详细解析,用黑窗口可以直接运行,

我试验过了,没问题

import javax.swing.Icon;
import javax.swing.JOptionPane;
public class CaiShuZi4JOptionPane {
/**
* @param args
*/
public static void main(String[] args) {
Icon icon = null;
boolean bl = false;
int put = 0;
int c = (int) (((Math.random())*100)+1); //获取一个1-100的随机数
System.out.println("你获取的随机数是:"+c); //打印你的随机数字

String str1 = (String) JOptionPane.showInputDialog(null,"请输入你的猜测数字(1-100): ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入"); //第一次输入你的猜测数字

if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次游戏"); //如果你点取消那么本次游戏结束
}else{
bl = num(str1); //判断是输入的是不是数字或者是整数
if(true==bl){ //如果是数字的话进入与随机数比较的程序
System.out.println("你输入的数字是:"+str1); //打印你输入的数字
put = Integer.valueOf(str1);

for(int i = 4;i > 0;i--){ //i是你可以猜测的次数
if(put==c){
JOptionPane.showMessageDialog(null, "恭喜你猜对了,正确答案是:"+c+"。"); //如果你猜对了就直接结束循环
break;
}else if(put>c){ //如果输大了就让你再次从新输入
str1 = (String) JOptionPane.showInputDialog(null,"你的输入过大。你还有"+i+"次机会,请重新输入: ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入");
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次输入");
break;
}else{
bl =num(str1);
if(true==bl){
put = Integer.valueOf(str1);
}else{
JOptionPane.showMessageDialog(null, "你的输入不正确,请重新输入");
}
}
}else if(put<c){ //如果你输小了也让你从新输入
str1 = (String) JOptionPane.showInputDialog(null,"你的输入过小。你还有"+i+"次机会,请重新输入: ","猜数字游戏",JOptionPane.PLAIN_MESSAGE,icon,null,"在这输入");
if(str1==null){
JOptionPane.showMessageDialog(null, "你已经取消了本次输入");
break;
}else{
bl =num(str1);
if(true==bl){
put = Integer.valueOf(str1);
}else{
JOptionPane.showMessageDialog(null, "你的输入不正确,请重新输入");
}
}
}
}


}else if(bl==false){ //这个 是你第一次如果填写的不是数字的话也会结束本次游戏
JOptionPane.showMessageDialog(null, "请您下次按要求填写。本次游戏结束");
}
if(true==bl && c!=put){ //如果你i次都没猜对,那么就直接告诉你这个数十什么
JOptionPane.showMessageDialog(null, "很遗憾你没能猜对,这个数字是:"+c+".");
}

}

}

public static boolean num(String value){ //一个静态方法,判断你输入的是不是数字
try {
Integer.parseInt(value);
return true;
} catch (Exception e) {
return false;
}

}
}

④ 求一个简单的java游戏 我是一个java初学者 考试叫我们做一个游戏 不知道什么游戏简单 还有请

[email protected]已经发送

⑤ 用JAVA编一个小游戏或者其他程序

import java.util.Random;
import java.util.Scanner;

public class Game {

private static int win=0;
private static int fail=0;
private static int pi=0;
private static void check(int cpu,int pe){
int t=0;
if(pe-cpu==2) t= -1;
else if(pe-cpu==-2) t= 1;
else t=pe-cpu;
if(t>0) {System.out.println("你赢了!");win++;}
else if(t==0) {System.out.println("咱们平了!");pi++;}
else {System.out.println("你输了!");fail++;}
}
public static void main(String[] args) {
String input="";
String cpuStr="";
Random rand=new Random();
int cpu=0;
int pe=0;
while(true){
System.out.println("*************************小游戏一个 输e/E可以退出*****************");
System.out.println("请选择你要出什么?F--剪刀(),S--石头(stone),C--布(cloth)");
Scanner scan=new Scanner(System.in);
input=scan.nextLine();
cpu=rand.nextInt(3);
if(cpu==0)cpuStr="剪刀";
else if(cpu==1)cpuStr="石头";
else cpuStr="布";

if(input.equals("F")||input.equals("f")){
pe=0;
System.out.println("你出的是,剪刀");
System.out.println("我出"+cpuStr);
check(cpu,pe);
}else if(input.equals("S")||input.equals("s")){
pe=1;
System.out.println("你出的是,石头");
System.out.println("我出"+cpuStr);
check(cpu,pe);
}else if(input.equals("C")||input.equals("c")){
pe=2;
System.out.println("你出的是,布");
System.out.println("我出"+cpuStr);
check(cpu,pe);
}else if(input.equals("E")||input.equals("e")){
System.out.println("结束游戏。。");
System.out.println("结果统计:");
System.out.println("胜:"+win+"局");
System.out.println("负:"+fail+"局");
System.out.println("平:"+pi+"局");
System.exit(0);
}
}

}

}

以上回答参考:
http://..com/question/39899654.html

⑥ 跪求一份用java写的简单小游戏以及设计思路

建议去csdn查找里面有源码你可以敲一遍看看效果再理解

⑦ 用Java开发简单的游戏

使用png格式的图片,除去坦克以外部分镂空,一来看起来好看点,二来能减少不少不必要的像素绘制。
另外就是图片尽量小点,宁可作做放大处理,图片资源越小,图片纹理越小,加载到内存的过程越快。另外对于这种坦克、还有场景的一些固有的资源图片,最好不要让它自动从内存中释放掉,打开游戏的时候自己做个预加载这些资源到内存中,整个程序结束的时候再从内存中释放资源。java和objective-c都是有资源引用计数的,一开始你就给它们多添加一次引用就可以保证它们不会被自动释放了(java我不怎么用了,应该有现有的库做这种事的吧,至少做android游戏开发内存预加载常要用的。)

⑧ 一个简单的JAVA做的小游戏

我也不知道你要什么样的游戏
我随便贴了一个

第一个Java文件:
import java.util.Scanner;
public class GameA_B {
public static void main(String[] args) {
Scanner reader=new Scanner(System.in);
int area;
System.out.println("Game Start…………Please enter the area:(1-9)" +
'\n'+"1,2,3 means easy"+'\n'+"4,5,6 means middle"+'\n'+
"7,8,9 means hard"+'\n'+"Please choose:");
area=reader.nextInt();
switch((area-1)/3)
{
case 0:System.out.println("You choose easy! ");break;
case 1:System.out.println("You choose middle! ");break;
case 2:System.out.println("You choose hard! ");break;
}
System.out.println("Good Luck!");
GameProcess game1=new GameProcess(area);
game1.process();
}

}

第二个Java文件:
import java.util.Random;
import java.util.Scanner;

public class GameProcess {
int area,i,arrcount,right,midright,t;
int base[]=new int[arrcount],userNum[]=new int[area],sysNum[]=new int[area];
Random random=new Random();
Scanner reader=new Scanner(System.in);
GameProcess(int a)
{
area=a;
arrcount=10;
right=0;
midright=0;
t=0;
base=new int[arrcount];
userNum=new int[area];
sysNum=new int[area];
for(int i=0;i<arrcount;i++)
{
base[i]=i;
//System.out.println(base[i]);
}
}

void process()
{
rand();
while(right!=area)
{
scanf();
compare();
print();
check();
}
}
void rand()
{
for(i=0;i<area;i++)
{
t=random.nextInt(arrcount);
//System.out.println(t);
sysNum[i]=base[t];
System.out.println(base[t]);
delarr(t);
}

}
void delarr(int t)
{
for(int j=t;j<arrcount-1;j++)
base[j]=base[j+1];
arrcount--;
}
void scanf()
{
System.out.println("The system number has created!"+"\n"+"Please enter "+area+" Numbers");
for(int i=0;i<area;i++)
{
userNum[i]=reader.nextShort();
}
}
void check()
{
if(right==area)
System.out.println("You win…………!");
}
boolean check(int i)
{
return true;
}
void compare()
{
int i=0,j=0;
right=midright=0;
for(i=0;i<area;i++)
{
for(j=0;j<area;j++)
{
if(userNum[i]==sysNum[j])
{
if(i==j)
right++;
else
midright++;
}
}
}
}
void print()
{
System.out.println(" A "+right+" B "+midright);
}
}

希望能帮到你
忘点赞