| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1130 人关注过本帖
标题:怎样在JAVA小游戏中做出移动的小狗呀?
只看楼主 加入收藏
ashaka
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-12-20
收藏
 问题点数:0 回复次数:8 
怎样在JAVA小游戏中做出移动的小狗呀?
本人是JAVA超级新手
我准备做一个JAVA小游戏,在游戏中要实现一只移动的小狗(自动移动的)
但是我不清楚怎样用JAVA画狗
请那位高手指点一下~
谢谢先~~~

搜索更多相关主题的帖子: JAVA 小游戏 超级 
2005-12-20 16:53
cll19820814
Rank: 2
等 级:新手上路
威 望:3
帖 子:328
专家分:0
注 册:2005-11-30
收藏
得分:0 
在JAVA里面画只狗出来???这个比较难吧??
把狗滴图片放到窗体上,做个线程,每N秒图片x 坐标+ X;刷新窗体。
这样应该就可以了吧??
本人也是新人,线程没玩过,加载图片试过但是失败了N次,还在实验中....

懵懵懂懂,看千遍而不会;设身处地,试一下就成功!
2005-12-20 17:26
新坏男人
Rank: 1
等 级:新手上路
威 望:1
帖 子:38
专家分:0
注 册:2005-12-7
收藏
得分:0 

import java.applet.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.Graphics;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.*;
import java.awt.image.*;

import sun.audio.*;

import java.lang.System;
import java.util.*;

import java.applet.AudioClip;

public class TestDrawFlc extends Frame
{
static TestDrawFlc m_Draw;
java.util.Timer timer;
int x=30;


private Dimension offDimension;
private Image offImage;
private Graphics offGraphics;


public TestDrawFlc(String Title)
{
super(Title);
setSize(800,600);
timer = new java.util.Timer();
TimerTask task = new MyTask();
timer.schedule(task,30,30);
}

public void paint(Graphics g)
{

}

public void update(Graphics g)
{

Dimension d = size();

if ((offGraphics == null) || (d.width != offDimension.width)
|| (d.height != offDimension.height))
{
offDimension = d;
offImage = createImage(d.width, d.height);
offGraphics = offImage.getGraphics();
}

offGraphics.setColor(new Color(255,255,255));
offGraphics.fillRect(0,0,800,800);
offGraphics.setColor(new Color(255,0,0));
offGraphics.fillRect(x,30,80,80);
x+=3;
if(x>800)
{
x=30;
}


g.drawImage(offImage, 0, 0, null);
}

public static void main(String[] args)
{
m_Draw=new TestDrawFlc("动画研究程序");
m_Draw.pack();
m_Draw.show();
m_Draw.repaint();
}
}


class MyTask extends TimerTask
{
public void run()
{
TestDrawFlc.m_Draw.repaint();

}
}



~~ 这个程序希望能有点帮助!!


/UploadFile/2005-11/2005112317153975.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./UploadFile/2005-11/2005112317153975.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-12-20 17:57
kai
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:52
帖 子:3450
专家分:59
注 册:2004-4-25
收藏
得分:0 
中国人都怎么了?看看楼主的名字,如果没有搞错的话,又是个矮鬼的名字。国格,人格都到哪里去了。

自由,民主,平等,博爱,进步.
中华民国,我的祖国,中华民国万岁!中华民国加油!
本人自愿加入中国国民党,为人的自由性,独立性和平等性而奋斗!
2005-12-20 19:58
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
阿萨卡 是日本名么?怎么我觉象东欧风格

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2005-12-20 20:06
新坏男人
Rank: 1
等 级:新手上路
威 望:1
帖 子:38
专家分:0
注 册:2005-12-7
收藏
得分:0 
以下是引用kai在2005-12-20 19:58:00的发言:
中国人都怎么了?看看楼主的名字,如果没有搞错的话,又是个矮鬼的名字。国格,人格都到哪里去了。

名字不过是个代号而已!~!又何必太在意呢!!


/UploadFile/2005-11/2005112317153975.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./UploadFile/2005-11/2005112317153975.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-12-20 20:18
雨夜黑黑
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2005-12-20
收藏
得分:0 
我们是来讨论问题的,对于代名词不用太在意了,我是第一次来这个网站,很高兴认识大家,希望以后多多帮助,共同进步
2005-12-20 21:13
cll19820814
Rank: 2
等 级:新手上路
威 望:3
帖 子:328
专家分:0
注 册:2005-11-30
收藏
得分:0 
kai老大,你也太敏感了吧??

懵懵懂懂,看千遍而不会;设身处地,试一下就成功!
2005-12-20 22:39
bagger
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:33
帖 子:891
专家分:0
注 册:2005-8-16
收藏
得分:0 
kai还是那么敏感!
不过中国还是要有一些像kai这样经常提醒提醒广大民众的人!
但,技术论坛里好象有些太敏感!
还是讨论一下问题吧!
我要声明,这个问题我是不懂,希望我的偶像kai能帮忙解答一下呗!

【三元毕业设计论文】
三元论文真的只有三元钱
客服QQ:742670649
http://shop35094218./
2005-12-21 09:01
快速回复:怎样在JAVA小游戏中做出移动的小狗呀?
数据加载中...
 
   



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

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