扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
用flash比较合适
坚守“ 做人真诚 · 做事靠谱 · 口碑至上 · 高效敬业 ”的价值观,专业网站建设服务10余年为成都OPP胶袋小微创业公司专业提供企业网站设计营销网站建设商城网站建设手机网站建设小程序网站建设网站改版,从内容策划、视觉设计、底层架构、网页布局、功能开发迭代于一体的高端网站建设服务。
画一个人,把他的手脚都另外分一个图层,双腿双脚要四个图层,然后把他们的控制点放到手臂的顶端,左手往右,右手就往左,腿也是一样,
至于自动重复,在flash里面,它播放的动画默认设置是循环的,
播放的帧数没了,它自动会回到第一帧播放,也就达到了自动重复的效果
你去试一下
建议直接用J3D做,这样直接就是3D游戏了。可以用3DMax建模,在J3D中直接操作模型,比较适合这种游戏。唯一比较复杂的就是有仿射几何的概念,就是物体旋转需要用乘法,试一试你就知道了。
你是说HangMan吧,你百度搜索一下HangMan JAVA ,就可以找到了,网上有很多。
我自己编了一个程序,有2个文件,我先说一下思路
用线程编程
监听鼠标移动事件,用线程不断获取鼠标坐标
根据鼠标坐标和眼球坐标来画出眼球的位置
package s0124随鼠标动眼睛;
//最初编写出问题的原因是没有明白把要做的事情放到run方法里面
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Main extends JFrame{
static int xx;
static int yy;
JPanel drawpanel;
Graphics g;
public static void main(String[] args) {
Main a=new Main();
}
public Main()
{
this.setTitle("随着鼠标动眼睛");
this.setSize(500,500);
this.setLocationRelativeTo(null); //设置窗体出现位置居中
this.setDefaultCloseOperation(3); //设置窗体的关闭操作
this.setResizable(false); //设置禁止调整窗体的大小
this.setLayout(new BorderLayout()); //设置为边框布局
drawpanel=new JPanel(); //新建一个画图面板
this.add(drawpanel,BorderLayout.CENTER); //将画图面板添加到窗体的中间位置
this.setVisible(true); //设置窗体可见
g=drawpanel.getGraphics(); //得到画图面板的画笔,为了传递给监听器listener
MyThread mt=new MyThread(g,drawpanel); //新建一个监听器,并把参数传递进去
drawpanel.addMouseMotionListener(mt); //为画图面板添加监听对象
Thread r=new Thread(mt);
r.start(); //启动线程
}
}
package s0124随鼠标动眼睛;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import javax.swing.JPanel;
import javax.swing.plaf.SliderUI;
public class MyThread implements Runnable,MouseMotionListener{
int x;
int y;
Graphics g;
JPanel drawpanel;
public MyThread(Graphics g,JPanel drawpanel)
{
this.g=g;
this.drawpanel=drawpanel;
}
public void run()
{
while(true)
{
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
g.clearRect(0, 0, 600, 600);
g.drawOval(100, 100, 100, 100);
g.drawOval(300, 100, 100, 100);
//画左眼球
int x1=150+(x-150)/5;
int y1=150+(y-150)/5;
g.fillOval(x1-15,y1-15, 30,30);
//画右眼球
int x2=350+(x-350)/5;
int y2=150+(y-150)/5;
g.fillOval(x2-15,y2-15, 30,30);
g.drawLine(200, 300, 250, 250);
g.drawLine(250, 250,300,300);
g.drawLine(150, 350, 350, 350);
}
}
public void mouseDragged(MouseEvent e) {
}
public void mouseMoved(MouseEvent e) {
x=e.getX();
y=e.getY();
}
}
#include stdio.h
int main() {
char* s[] = {"______________$$$$$$$",
"_____________$$$$$$$$$",
"____________$$$$$$$$$$$",
"____________$$$$$$$$$$$",
"____________$$$$$$$$$$$",
"_____________$$$$$$$$$",
"_____$$$$$$_____$$$$$$$$$$",
"____$$$$$$$$__$$$$$$_____$$$",
"___$$$$$$$$$$$$$$$$_________$",
"___$$$$$$$$$$$$$$$$______$__$",
"___$$$$$$$$$$$$$$$$_____$$$_$",
"___$$$$$$$$$$$__________$$$_$_____$$",
"____$$$$$$$$$____________$$_$$$$_$$$$",
"______$$$__$$__$$$______________$$$$",
"___________$$____$_______________$",
"____________$$____$______________$",
"_____________$$___$$$__________$$",
"_______________$$$_$$$$$$_$$$$$",
"________________$$____$$_$$$$$",
"_______________$$$$$___$$$$$$$$$$",
"_______________$$$$$$$$$$$$$$$$$$$$",
"_______________$$_$$$$$$$$$$$$$$__$$",
"_______________$$__$$$$$$$$$$$___$_$",
"______________$$$__$___$$$______$$$$",
"______________$$$_$__________$$_$$$$",
"______________$$$$$_________$$$$_$_$",
"_______________$$$$__________$$$__$$",
"_____$$$$_________$________________$",
"___$$$___$$______$$$_____________$$",
"__$___$$__$$_____$__$$$_____$$__$$",
"_$$____$___$_______$$$$$$$$$$$$$",
"_$_____$____$_____$$$$$$__$$$$$$$$"};
int LENGTH = 32;
int i = 0;
for (i = 0; i LENGTH; i++) {
printf("%s\n", s[i]);
}
}
多了一个最后的大括号}。
编写程序请养成缩格书写的习惯!
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流