① 求Java課程設(shè)計(jì)—小游戲(含源代碼)
成都創(chuàng)新互聯(lián)公司始終堅(jiān)持【策劃先行,效果至上】的經(jīng)營理念,通過多達(dá)十載累計(jì)超上千家客戶的網(wǎng)站建設(shè)總結(jié)了一套系統(tǒng)有效的全網(wǎng)整合營銷推廣解決方案,現(xiàn)已廣泛運(yùn)用于各行各業(yè)的客戶,其中包括:成都OPP膠袋等企業(yè),備受客戶表揚(yáng)。
//hi./srxboys/item/8ce4743da1adc991c2cf29c4
Tank——坦克大戰(zhàn)(簡潔版)源代碼-------(此文檔是自己在韓順平教程總結(jié)而來)
*功能:1.防止敵人的坦克重疊運(yùn)動(dòng)
*(決定把判斷是否碰撞的函數(shù)寫到EnemyTank類)
*2.可以分關(guān)
*2.1(做一個(gè)開始的Panel,它是一個(gè)空的)
*2.2開始字體閃爍
*3.可以在玩游戲的時(shí)候,暫停和繼續(xù)
*3.1當(dāng)用戶點(diǎn)擊暫停時(shí),子彈的速度和坦克速度設(shè)為0,并讓坦克的方向
*不要發(fā)生變化。
*4.可以記錄玩家的成績
*4.1用文件流的方式(小游戲)[大游戲是用的數(shù)據(jù)庫cs,bs結(jié)構(gòu),三國]
*4.2單寫一個(gè)記錄類,完成對玩家的記錄
*4.3先完成保存共擊毀了多少輛敵人坦克的功能
*4.4存盤退出游戲,可以記錄當(dāng)時(shí)的敵人的坦克坐標(biāo),并可以恢復(fù)
*5.java如何操作聲音文件
*/
② JAVA課程設(shè)計(jì),求個(gè)能用eclipse實(shí)現(xiàn)小游戲或小程序的源代碼。感激不盡
你自己來去下自載吧,這里面都有 //oschina/project/java
③ 用JAVA編寫一個(gè)小游戲
前天寫的猜數(shù)字游戲,yongi控制猜測次數(shù),有詳細(xì)解析,用黑窗口可以直接運(yùn)行,
我試驗(yàn)過了,沒問題
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); //獲取一個(gè)1-100的隨機(jī)數(shù)
System.out.println("你獲取的隨機(jī)數(shù)是:"+c); //打印你的隨機(jī)數(shù)字
String str1 = (String) JOptionPane.showInputDialog(null,"請輸入你的猜測數(shù)字(1-100): ","猜數(shù)字游戲",JOptionPane.PLAIN_MESSAGE,icon,null,"在這輸入"); //第一次輸入你的猜測數(shù)字
if(str1==null){
JOptionPane.showMessageDialog(null, "你已經(jīng)取消了本次游戲"); //如果你點(diǎn)取消那么本次游戲結(jié)束
}else{
bl = num(str1); //判斷是輸入的是不是數(shù)字或者是整數(shù)
if(true==bl){ //如果是數(shù)字的話進(jìn)入與隨機(jī)數(shù)比較的程序
System.out.println("你輸入的數(shù)字是:"+str1); //打印你輸入的數(shù)字
put = Integer.valueOf(str1);
for(int i = 4;i 0;i--){ //i是你可以猜測的次數(shù)
if(put==c){
JOptionPane.showMessageDialog(null, "恭喜你猜對了,正確答案是:"+c+"。"); //如果你猜對了就直接結(jié)束循環(huán)
break;
}else if(putc){ //如果輸大了就讓你再次從新輸入
str1 = (String) JOptionPane.showInputDialog(null,"你的輸入過大。你還有"+i+"次機(jī)會,請重新輸入: ","猜數(shù)字游戲",JOptionPane.PLAIN_MESSAGE,icon,null,"在這輸入");
if(str1==null){
JOptionPane.showMessageDialog(null, "你已經(jīng)取消了本次輸入");
break;
}else{
bl =num(str1);
if(true==bl){
put = Integer.valueOf(str1);
}else{
JOptionPane.showMessageDialog(null, "你的輸入不正確,請重新輸入");
}
}
}else if(putc){ //如果你輸小了也讓你從新輸入
str1 = (String) JOptionPane.showInputDialog(null,"你的輸入過小。你還有"+i+"次機(jī)會,請重新輸入: ","猜數(shù)字游戲",JOptionPane.PLAIN_MESSAGE,icon,null,"在這輸入");
if(str1==null){
JOptionPane.showMessageDialog(null, "你已經(jīng)取消了本次輸入");
break;
}else{
bl =num(str1);
if(true==bl){
put = Integer.valueOf(str1);
}else{
JOptionPane.showMessageDialog(null, "你的輸入不正確,請重新輸入");
}
}
}
}
}else if(bl==false){ //這個(gè) 是你第一次如果填寫的不是數(shù)字的話也會結(jié)束本次游戲
JOptionPane.showMessageDialog(null, "請您下次按要求填寫。本次游戲結(jié)束");
}
if(true==bl c!=put){ //如果你i次都沒猜對,那么就直接告訴你這個(gè)數(shù)十什么
JOptionPane.showMessageDialog(null, "很遺憾你沒能猜對,這個(gè)數(shù)字是:"+c+".");
}
}
}
public static boolean num(String value){ //一個(gè)靜態(tài)方法,判斷你輸入的是不是數(shù)字
try {
Integer.parseInt(value);
return true;
} catch (Exception e) {
return false;
}
}
}
④ 用java制作一個(gè)小游戲 教學(xué)
static Scanner in =new Scanner(System.in);
public static int aaa(){
int c = 0;
while(true){
try {
if(c999c10000){
break;
}else{
// System.out.println("請輸入4位整數(shù)");
c= in.nextInt();
if(c999c10000){
break;
}else{
System.out.println("輸入有誤,請重新輸入4位整數(shù)");
}
}
} catch (Exception e) {
System.out.println("請輸入整數(shù)");
c= in.nextInt();
}
}
//in.close();
return c;
}
public static void cai(){
//Scanner sa =new Scanner(System.in);
int haoma=(int)(Math.random()*10000);
if(haoma999)
{
haoma = Integer.parseInt(String.valueOf(haoma)+"0");
}
System.out.println(haoma);
System.out.println("請輸入一位4位整數(shù)");
int aa = 0;
while(true){
aa= aaa();
String pd=String.valueOf(aa);
if(pd.length()!=4){
aa = aaa();
}else{
break;
}
}
while(true){
if(aa==haoma){
System.out.println("你猜對了,可以去買彩票了");
}else{
System.out.println("抱歉 , 你猜錯(cuò)了");
}
System.out.println("是否繼續(xù)1繼續(xù) 其他結(jié)束");
try {
int ss = in.nextInt();
if(ss==1){
cai();
}else{
break;
}
} catch (Exception e) {
in.close();
break;
}
}
}
public static void main(String[] args) {
System.out.println("歡迎來到猜號小游戲");
cai();
System.out.println("over");
}
⑤ 想做一個(gè)java小游戲 誰能給幾個(gè)創(chuàng)意啊 注意 是創(chuàng)意!!!!! 不是已有的有創(chuàng)意的小游戲
比如有東西扔過來,選擇吃掉或者躲開,考反應(yīng)吧。
⑥ 急求java課程設(shè)計(jì),內(nèi)容可以是小游戲的,如(迷宮,計(jì)算器,停車場之戀的),要能運(yùn)行,謝謝
俄羅斯方塊,貪吃蛇。推箱子。
⑦ 求JAVA期末課程設(shè)計(jì),要那種開發(fā)的小項(xiàng)目軟件。可以是像記事本那種,也可以是小游戲那種。
網(wǎng)上搜不到的一般是不可共享的資源,建議去圖書館找本專門針對課程設(shè)計(jì)的書,里面的資料很豐富,你可以照著做一下,并作功能上適當(dāng)?shù)脑鰷p,這樣網(wǎng)上就很難找到了
Tank——坦克大戰(zhàn)(簡潔版)源代碼-------(此文檔是自己在韓順平教程總結(jié)而來)
*????功能:?1.防止敵人的坦克重疊運(yùn)動(dòng)
*?????????????(決定把判斷是否碰撞的函數(shù)寫到EnemyTank類)
*??????????2.可以分關(guān)
*??????????????2.1?(做一個(gè)開始的Panel,它是一個(gè)空的)
*??????????????2.2?開始字體閃爍
*??????????3.可以在玩游戲的時(shí)候,暫停和繼續(xù)
*??????????????3.1當(dāng)用戶點(diǎn)擊暫停時(shí),子彈的速度和坦克速度設(shè)為0,并讓坦克的方向
*?????????????????不要發(fā)生變化。
*??????????4.可以記錄玩家的成績
*??????????????4.1用文件流的方式(小游戲)[大游戲是用的數(shù)據(jù)庫cs,bs結(jié)構(gòu),三國]
*??????????????4.2單寫一個(gè)記錄類,完成對玩家的記錄
*??????????????4.3先完成保存共擊毀了多少輛敵人坦克的功能
*??????????????4.4存盤退出游戲,可以記錄當(dāng)時(shí)的敵人的坦克坐標(biāo),并可以恢復(fù)
*??????????5.java如何操作聲音文件
*/
import java.awt.*;
import java.awt.event.*;
public class DengLuJieMian extends Frame implements ActionListener
{
Label username=new Label("用戶名:");//使用文本創(chuàng)建一個(gè)用戶名標(biāo)簽
TextField t1=new TextField();//創(chuàng)建一個(gè)文本框?qū)ο?/p>
Label password=new Label("密碼:");//創(chuàng)建一個(gè)密碼標(biāo)簽
TextField t2=new TextField();
Button b1=new Button("登陸");//創(chuàng)建登陸按鈕
Button b2=new Button("取消");//創(chuàng)建取消按鈕
public DengLuJieMian()
{
this.setTitle("學(xué)生信息管理系統(tǒng)");//設(shè)置窗口標(biāo)題
this.setLayout(null);//設(shè)置窗口布局管理器
username.setBounds(50,40,60,20);//設(shè)置姓名標(biāo)簽的初始位置
this.add(username);// 將姓名標(biāo)簽組件添加到容器
t1.setBounds(120,40,80,20);// 設(shè)置文本框的初始位置
this.add(t1);// 將文本框組件添加到容器
password.setBounds(50,100,60,20);//密碼標(biāo)簽的初始位置
this.add(password);//將密碼標(biāo)簽組件添加到容器
t2.setBounds(120,100,80,20);//設(shè)置密碼標(biāo)簽的初始位置
this.add(t2);//將密碼標(biāo)簽組件添加到容器
b1.setBounds(50,150,60,20);//設(shè)置登陸按鈕的初始位置
this.add(b1);//將登陸按鈕組件添加到容器
b2.setBounds(120,150,60,20);//設(shè)置取消按鈕的初始位置
this.add(b2);// 將取消按鈕組件添加到容器
b1.addActionListener(this);//給登陸按鈕添加監(jiān)聽器
b2.addActionListener(this);// 給取消按鈕添加監(jiān)聽器
this.setVisible(true);//設(shè)置窗口的可見性
this.setSize(300,200);//設(shè)置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});//通過內(nèi)部類重寫關(guān)閉窗體的方法
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)//處理登陸事件
{
String name=t1.getText();
String pass=t2.getText();
if(name!=nullpass.equals("000123"))//判斷語句
{
new StudentJieMian();
}
}
}
public static void main(String args[])//主函數(shù)
{
new DengLuJieMian();
}
}
以下方法實(shí)現(xiàn)了學(xué)生界面設(shè)計(jì)
import java.awt.*;
import java.awt.event.*;
class StudentJieMian extends Frame implements ActionListener
{
MenuBar m=new MenuBar();//創(chuàng)建菜單欄
Menu m1=new Menu("信息");//創(chuàng)建菜單“信息”
MenuItem m11=new MenuItem("插入");//創(chuàng)建“插入”的菜單項(xiàng)
MenuItem m12=new MenuItem("查詢");
Menu m2=new Menu("成績");//創(chuàng)建菜單“成績”
MenuItem m21=new MenuItem("查詢");
public StudentJieMian()
{
this.setTitle("學(xué)生界面");//設(shè)置窗口標(biāo)題
this.setLayout(new CardLayout());//設(shè)置窗口布局管理器
this.setMenuBar(m);//將菜單欄組件添加到容器
m.add(m1);//將信息菜單放入菜單欄
m.add(m2);
m1.add(m11);//將“插入”菜單項(xiàng)添加到“信息”菜單
m1.add(m12); //將“查詢”菜單項(xiàng)添加到“信息”菜單
m2.add(m21); //將“查詢”菜單項(xiàng)添加到“成績”菜單
m11.addActionListener(this); //給“插入”菜單項(xiàng)添加監(jiān)聽器
m12.addActionListener(this); //給“查詢”菜單項(xiàng)添加監(jiān)聽器
m21.addActionListener(this); //給“查詢”菜單項(xiàng)添加監(jiān)聽器
this.setVisible(true); //設(shè)置窗口的可見性
this.setSize(300,200); //設(shè)置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);//關(guān)閉窗口
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==m11) //處理“添加信息”事件
{
new AddStudent();
}
if(e.getSource()==m12) //處理“查詢信息”事件
{
new SelectStudent();
}
if(e.getSource()==m21) //處理“查詢成績”事件
{
new ChengJiStudent();
}
}
public static void main(String args[])
{ new StudentJieMian(); //創(chuàng)建一個(gè)對象 }
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
public class game21 extends JFrame {
private JLabel label_2;
private int number;
private int sum;
final JLabel label = new JLabel();
final JLabel label_1 = new JLabel();
public static void main(String[] args) {
new game21();
}
public game21() {
super("21點(diǎn)?!");
getContentPane().setLayout(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton button = new JButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent arg0) {
onClick();
}
});
button.setText("出牌");
button.setBounds(170, 350, 106, 28);
getContentPane().add(button);
label.setBorder(new LineBorder(Color.black, 1, false));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("", Font.BOLD, 26));
label.setText("背面");
label.setBounds(158, 81, 137, 153);
getContentPane().add(label);
label_1.setText("你已經(jīng)擁有的牌:");
label_1.setBounds(109, 22, 270, 45);
getContentPane().add(label_1);
this.setBounds(200, 300, 501, 528);
this.setVisible(true);
getContentPane().add(getLabel_2());
}
public int randNumber() {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
return (int) (Math.random() * 10 + 1);
}
public void onClick() {
number = this.randNumber();
this.sum += number;
label.setText("" + number);
String strTemp = this.label_1.getText();
strTemp += "" + number + " ";
label_1.setText(strTemp);
String temp = "合計(jì):" + sum;
label_2.setText(temp);
isWin();
}
public void isWin() {
if (sum 21) {
JOptionPane.showMessageDialog(this, "你輸了");
clear();
return;
} else if (sum == 21) {
JOptionPane.showMessageDialog(this, "你贏了");
clear();
return;
} else {
int i = JOptionPane.showOptionDialog(this, "是否繼續(xù)?", "提示",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, null, null);
if (i == JOptionPane.OK_OPTION) {
onClick();
} else
return;
}
}
private void clear() {
label_2.setText("合計(jì):");
sum = 0;
number = 0;
label_1.setText("你已經(jīng)擁有的牌:");
}
/**
* @return
*/
protected JLabel getLabel_2() {
if (label_2 == null) {
label_2 = new JLabel();
label_2.setText("合計(jì):");
label_2.setBounds(313, 35, 66, 18);
}
return label_2;
}
}
真好無聊中。。
文章題目:java課程設(shè)計(jì)含源代碼 java課程設(shè)計(jì)含源代碼嗎
分享地址:http://vcdvsql.cn/article8/dooodip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、靜態(tài)網(wǎng)站、定制開發(fā)、網(wǎng)站維護(hù)、定制網(wǎng)站、品牌網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)