游动的代码
『壹』 急求!!! QQ空间鼠标代码, 一条鱼跟着鼠标游动 的代码谁有重谢!
楼主,你看下是不是下面这个
http://www.hahalai.com/bbs/viewthread.php?tid=827&extra=
『贰』 游走的字符程序C源代码
对与我来说这问题真有点难度,要是用java就好了
C不太清楚
『叁』 在Java游戏中让一个人物走动的代码是什么
代码主要为以下:
package com.lovo.game.frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import javax.swing.JFrame;
import com.lovo.game.role.Fire;
import com.lovo.game.role.GameMap;
import com.lovo.game.role.ZhaoYun;
import com.lovo.game.util.TrackerInit;
public class GameStartFrame extends JFrame implements Runnable{
private Image memoryImage;
private Graphics memoryGraphics;
public static boolean isRun = true;
private static GameMap gameMap = new GameMap();
private ZhaoYun zy = new ZhaoYun();
private Fire fire = new Fire();
public GameStartFrame(){
this.setSize(900,700);
this.setVisible(true);
this.setDefaultCloseOperation(3);
//设置居中
this.setLocationRelativeTo(null);
//初始化双缓冲画布、画笔
this.memoryImage = this.createImage(900,700);
this.memoryGraphics = this.memoryImage.getGraphics();
//媒体追踪器
MediaTracker tracker = new MediaTracker(this);
TrackerInit.initImage(tracker);
//启动线程
Thread th = new Thread(this);
th.start();
}
public static void main(String[] args) {
GameStartFrame game = new GameStartFrame();
}
public void run() {
while(isRun){
this.flushFrame();
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void flushFrame(){
gameMap.drawMap(memoryGraphics);
zy.drawImage(memoryGraphics);
fire.drawImage(memoryGraphics);
//将双缓冲画布中的图片显示在窗体
this.getGraphics().drawImage(this.memoryImage,0,0,this);
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.lovo.game.role;
import java.awt.Graphics;
import java.awt.Image;
public class GameMap {
public static Image mapImg;
public static int mapx;
public void drawMap(Graphics memoryGraphics){
mapx -=5;
if(mapx <=-17100){
mapx = -17100;
}
memoryGraphics.drawImage(mapImg,mapx,0,null);
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.lovo.game.role;
import java.awt.Graphics;
import java.awt.Image;
import com.lovo.game.util.MoveImageChange;
public class Fire {
public static Image[]fireImage;
private int x =100;
private int y =300;
private int width = 200;
private int height = 130;
private MoveImageChange moveChange = new MoveImageChange(3);
public void drawImage(Graphics memoryGraphics){
Image img = moveChange.imageChange(fireImage);
memoryGraphics.drawImage(img,this.x,this.y,this.width,this.height,null);
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.lovo.game.util;
import java.awt.MediaTracker;
import com.lovo.game.role.Fire;
import com.lovo.game.role.GameMap;
import com.lovo.game.role.ZhaoYun;
public class TrackerInit {
public static void initImage(MediaTracker tracker){
//初始化地图图片
GameMap.mapImg = CutImage.getSingleImage("image/map.jpg", tracker);
//赵云
ZhaoYun.zyImage = CutImage.cutOneImage("image/boss/playSpear.png",18, 236, 134,tracker);
//火
Fire.fireImage = CutImage.cutOneImage("image/fireImg.png", 6, 283, 161,tracker);
try {
//0组的图片全部等待加载完毕后,在显示
tracker.waitForID(0);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.lovo.game.util;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.image.CropImageFilter;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageProcer;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
public class CutImage {
public static Image[][] cutManyImage(String filePath, int row, int col,
int imageWidth, int imageHight,MediaTracker tracker) {
Image[][] img = new Image[row][col];
ImageIcon imIcon = new ImageIcon(filePath);// 创建图像数组对象
Image imgTemp = imIcon.getImage();// 创建源图像
// 为源 图象获取ImageProcer源
ImageProcer sourceProcer = imgTemp.getSource();
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
// 创建图片分割图像对象,第一、二个参数为分割图像起始坐标。后两个参数为图像大小
CropImageFilter cropImg = new CropImageFilter(j * imageWidth, i * imageHight,imageWidth, imageHight);
ImageProcer imgProcer = new FilteredImageSource(sourceProcer, cropImg);
img[i][j] = new JFrame().createImage(imgProcer);
tracker.addImage(img[i][j], 0);
}
}
return img;
}
public static Image[] cutOneImage(String filePath,int col,
int imageWidth, int imageHight,MediaTracker tracker) {
Image[] img = new Image[col];
ImageIcon imIcon = new ImageIcon(filePath);// 创建图像数组对象
Image imgTemp = imIcon.getImage();// 创建源图像
// 为源 图象获取ImageProcer源
ImageProcer sourceProcer = imgTemp.getSource();
for (int j = 0; j < col; j++) {
// 创建图片分割图像对象,第一、二个参数为分割图像起始坐标。后两个参数为图像大小
CropImageFilter cropImg = new CropImageFilter(j * imageWidth, 0,imageWidth, imageHight);
ImageProcer imgProcer = new FilteredImageSource(sourceProcer, cropImg);
img[j] = new JFrame().createImage(imgProcer);
tracker.addImage(img[j], 0);
}
return img;
}
public static Image getSingleImage(String imgPath,MediaTracker tracker){
Image img = new ImageIcon(imgPath).getImage();
tracker.addImage(img, 0);
return img;
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.lovo.game.util;
import java.awt.Image;
public class MoveImageChange {
private int count;
private Image img;
private int frequency;
private int loopCount;
public MoveImageChange(int frequency){
this.frequency=frequency;
}
public MoveImageChange(int frequency,int count){
this.frequency=frequency;
this.count = count;
}
public Image imageChange(Image[] images){
if(img==null){//初始图片为第一张图片
img=images[0];
}
count++;
if(count>frequency){//当记数器大于频率时
count=0;
loopCount++;
if(loopCount >= images.length){//图片下标越界时
loopCount=0;
}
img=images[loopCount];
}
return img;
}
public void setLoopCount(int loopCount){
this.loopCount = loopCount;
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.lovo.game.role;
import java.awt.Graphics;
import java.awt.Image;
import com.lovo.game.util.MoveImageChange;
public class ZhaoYun {
public static Image[] zyImage;
private int x =600;
private int y =300;
private int width =200;
private int height =130;
private MoveImageChange moveChange = new MoveImageChange(3);
public void drawImage(Graphics memoryGraphics){
Image img = moveChange.imageChange(zyImage);
memoryGraphics.drawImage(img,this.x,this.y,this.width,this.height,null);
『肆』 新人求一个在水中游动的鱼的效果的flash源代码
这样说吧。你要做这个效果分为2步、第一步实现鱼的游动。第二步利用位图数据做水波。关于这个水波效果。网上可以搜到。至于鱼的游动。无非是角度和位移。主要是看你鱼的AI怎么设定。
『伍』 求一个跟随鼠标游动的鱼的FLASH代码 请高手进
元件1头,连接名为:yt
元件2身,连接名:ys
元件3尾巴,连接名:yz
主场景第1帧代码:
this.attachMovie("yt","xy0",21);
for (i=1;i<21;i++){
if(i == 13){
this.attachMovie("yz","xy"+i,i);
} else {
this.attachMovie("ys","xy"+i,i);
}
cys = eval("xy"+i);
cys._yscale -= i*5;
cys._xscale -= i*5;
}
第2帧代码:
ytx = _xmouse - xy0._x;
yty = _ymouse - xy0._y;
ytz = Math.atan2(yty,ytx)*180/Math.PI;
xy0._rotation = ytz;
xy0._x += ytx/10;
xy0._y += yty/10;
n=21;
while(n>0){
hys = eval("xy"+n);
qys = eval("xy"+(n-1));
ysx = qys._x - hys._x;
ysy = qys._y - hys._y;
ysz = Math.atan2(ysy,ysx)*180/Math.PI;
hys._rotation = ysz;
hys._x = qys._x;
hys._y = qys._y;
n--;
}
第3帧代码:
gotoAndPlay(2);
『陆』 网络游戏那些动作的代码在哪个文件夹
动作的代码在哪个文件夹不清楚
我在玩的动作游戏是怪物猎人OL
不管是刷怪还是休闲
都分别设计有贴合场景的背景音乐
怪物真实 更是提升了刀刀入肉的极致快感
还可以探寻新的怪物
真的抓住玩家这样的一个好奇心
想的十分周到
可玩性更高
『柒』 这是鱼游动的动画代码,请高手 解释下 并帮我改个400*200的鱼游动的范围 谢谢1
只要这几句改一下就可以了
bug._x = random(400) - 200;
bug._y = random(200) - 100;
top = -200;
bottom = 200;
left = -100;
right = 100;
『捌』 游动字幕代码怎么弄
上下滚动: <style> .marquee{ width:120px; height:200px; background-color:orange; } .tx{ top: 100px; } </style> <script> var func; var oTop = 180; function marquee(){ var tx = document.getElementById("tx"); tx.style.paddingTop = oTop; oTop -= 3; if(oTop <= 0){ oTop = 180; } } window.onload = function(){ out(); } function over(){ clearInterval(func); } function out(){ func = setInterval("marquee();", 80); } </script> </head> <body> <div class="marquee" id="marquee" onmouseover="over()" onmouseout="out()"> <div class="tx" id="tx" >滚动字幕的内容</div> </div> 左右滚动: <script language="JavaScript1.2"> /* */ //字幕宽度 var marqueewidth=330 //字幕高度(只对NC有效) var marqueeheight=10 //字幕速度(数值越大越快) var speed=10 //欢迎光临 var marqueecontents='字幕滚动的内容' if (document.all) document.write('<marquee scrollAmount='+speed+' style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>') function regenerate(){ window.location.reload() } function regenerate2(){ if (document.layers){ setTimeout("window.onresize=regenerate",450) intializemarquee() } } function intializemarquee(){ document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>') document.cmarquee01.document.cmarquee02.document.close() thelength=document.cmarquee01.document.cmarquee02.document.width scrollit() } function scrollit(){ if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){ document.cmarquee01.document.cmarquee02.left-=speed setTimeout("scrollit()",100) } else{ document.cmarquee01.document.cmarquee02.left=marqueewidth scrollit() } } window.onload=regenerate2 </script>
求点赞
『玖』 CF游戏里的的动作代码,
B--1(2)(3)(4)换包
Z
.X.
C.--发无线电(只有队友可以看见)
ctrl--蹲
W-前进
A-左走
S-后退
D-右走
1
主武器
2
副武器
就是手枪
3
近身武器
4-投掷武器
R-换子弹
G
仍枪
Q
切换刚才使用的武器
左键射击
右键
使用瞄准器(使用于有瞄准器的)
回车
发言
ESC-菜单
F11-同意
F12-反对
TAB-看人数和杀的人数
F2-全部人可见说话
F3团队发言
F4
战队发言
纯手打
望点赞
谢谢
『拾』 C语言程序设计游动的鱼
不会是ASCII码,应该是C图形应用吧,我们没学那~~~~~~~