| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 529 人关注过本帖
标题:小游戏编程问题,急需帮忙!!(能解决的,有现金回谢)
只看楼主 加入收藏
lokasdfjkl
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-29
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
小游戏编程问题,急需帮忙!!(能解决的,有现金回谢)
必须在6月1号前解决!(6月1号交这作业)


本人在做一个类似于小时候玩的"坦克大战"的小游戏,

我的问题是

1,我想设置敌方的所有坦克(10辆)所走的路线有这样的规律:
        1,随机走
        2,当游戏一开始就自动走
        3,十字走法(意思是上,下,左,右,的走,而不能斜着走)


2,我要设置一个边框,就等于是游戏界面的边框,任何游戏里的东西都不得越界线,
而且当敌方坦克走到界面尽头(就是碰到边框的时候),会自动调头或者左右转方向走.

 
因为是要交到学校算学分的,
所以请高手说的详细点,或者+498569708QQ说
能帮我解决了问题的话,我会付酬劳,但是不多(100-200RMB)绝不食言!
如果还能交到朋友就更好.

以下是学校给我们的3个JAVA文件,
学过的人看了会知道我们大概学到什么范围
所以不要太深入的方法来做,只用最基础的
谢谢.

-----------------------

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MyJPanel extends JPanel {

     public MyJPanel() {

    }

       public void paintComponent(Graphics g){
         super.paintComponent(g);

    }

}
----------------


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MyJFrame extends JFrame {
    public MyJFrame(String title, int x, int y, int width, int height) {

        // Set the title, top left location, and close operation for the frame
        setTitle(title);
        setLocation(x, y);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Create an instance of the JPanel class, and set this to define the
        // content of the window
        JPanel frameContent = new MyJPanel();
        Container visibleArea = getContentPane();
        visibleArea.add(frameContent);

        // Set the size of the content pane of the window, resize and validate the
        // window to suit, obtain keyboard focus, and then make the window visible
        frameContent.setPreferredSize(new Dimension(width, height));
        pack();
        frameContent.requestFocusInWindow();
        setVisible(true);
    }
}
--------

/*
   The application class for the CompSci 101 graphical user interface

   The constructor for the MyJFrame object takes the following parameters:
     - a title
     - the x position of the top corner of the window
     - the y position of the top corner of the window
     - the width of the content pane of the window
     - the height of the content pane of the window
*/

public class MyApp {
    public static void main(String[] args) {
        MyJFrame gui = new MyJFrame("My GUI", 0, 0, 800, 600);
    }
}


搜索更多相关主题的帖子: 现金 小游戏 
2010-05-29 21:49
qq342991688
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:25
专家分:106
注 册:2010-5-30
收藏
得分:20 
可以用个随即函数获得1到4的随机数
2010-05-30 13:12
快速回复:小游戏编程问题,急需帮忙!!(能解决的,有现金回谢)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011023 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved