最简单的代码做游戏图片,怎么用代码做图片

1,怎么用代码做图片你到discuz官网下载相应的代码就行了!图片链接 用就可以了!试试这个图片切换有12345数字一起切换有小图大图一起切换里面有教程和源码
2,怎么编程一个最简单游戏代码利用随机数猜大?。?如下:1、代码的第一行,是一个include语句 。没有它我们的程序会编译不过 。有了它就是告诉编译器在对代码进行编译之前,必须要包含程序需要的文件 。这里的stdio.h就是我们需要的头文件 。2、代码第二行是一个main函数 , 这个main函数的返回值是一个int整型数据 。刚开始学习编程的时候我们可以认为程序运行的时候是从main函数开始的 。后续会专门给大家做一个介绍向大家说明在main函数之前还做了哪些事情 。3、每个函数都用一对“{}”进行包含 , 表示着函数体的开始和结束,当然后面说到控制语句的时候它还表示一段控制语句的开始和结束 。4、main函数中调用了一个printf函数 。它是用来向控制台输出我们想要的内容 。printf的函数定位格式为:int printf(constchar*format,...) 。format中定义了输出内容和格式 。5、return函数执行完后 。在退出函数体之前,会将函数进行返回 。return后的内容根据函数返回值定义而定 。在本段程序中返回的是整型数据0 。
3,如何用最简单的C代码生成游戏地图所有地图元素用数字来描述,然后调用rand(),随机分配各种地图元素 , 组合成地图;https://msdn.microsoft.com/en-us/library/398ax69y.aspx在控制台还是在gui上【最简单的代码做游戏图片,怎么用代码做图片】
4 , 如何制作微信h5小游戏导读:相信大家经常会在微信中看到一些趣味个性的微信h5小游戏,并且还会忍不住好奇,它们到底是如何制作的呢?其实,微信h5小游戏的制作步骤非常简单,只需要下面几步就能轻松完成 。利用微信游戏进行H5游戏营销,重要的就是要以用户为核心,制作出用户喜爱的游戏 。根据分析可知 , 《砸金蛋》活动是很多人都喜欢玩的游戏,而且用户参与门槛低,以下就为大家介绍《砸金蛋》的制作方法:1.注册并登录活动聚的微信游戏制作平台,注意该平台中的游戏一定要简单好玩 , 而且游戏管理系统也要完善,能够实现数据分析、兑奖、用户管理等功能,可以先手机模拟测试效果之后再进行选择 。2.通过游戏分类或搜索,找到《砸金蛋》微信h5游戏模板,或者使用其他与相关游戏 , 比如《扭扭蛋》、《刮一刮》《摇一摇》等,再根据用户喜好或需求进行选择 。3.点击创建 , 然后根据游戏界面需求,先简单设计一些图片素材 , 然后替换到界面中,让游戏真正变成自己的游戏,同时设置游戏规则,补充游戏奖品 , 尽量完善每一个设置栏目,充分发挥出h5小游戏的各个作用 。4.确定游戏制作完毕之后,在适当的时间对游戏进行发布操作 , 并将游戏二维码及链接发布到公众号或其他平台中,这样游戏营销活动就算正式开始了 。注意 , 前期的推广力度一定要强,毕竟微信活动的时效性是比较短的 。5.活动过程中,要保持微信公众平台客服或其他联系方式的畅通,保证能够及时为有需要的用户解决问题,同时为中奖用户进行兑奖安排,让活动顺利进行 。6.活动结束之后,可以总结性地对平台中给出的传播数据以及用户数据进行整理、分析 , 这些数据可以再手机端,小程序、也可以再pc端车看,在其他微信营销方案中也能发挥重要的作用 。请点击输入图片描述请点击输入图片描述活动聚的平台上还有更多微信吸粉的h5游戏模板 , 心动就赶紧行动吧5,Java 求一段射击小游戏的代码让一个小图片随机出现1、在JFrame上用网格布局批量实例化一些JLabel2、建立一个线程获得一个随机数,根据随机数给某个JLabel设置icon3、线程sleep(1000);4、移除这个JLabel的icon5、线程循环上图是程序运行的截图,每隔一秒钟图片随机定位刷新,代码不足50行,请测试....import javax.swing.*;import java.awt.*;import java.util.Random;public class Tt extends JFrame implements Runnable JLabel l; Icon img; public Tt() img = new ImageIcon("img.jpg"); l = new JLabel(img); this.setLayout (null); this.add (l); l.setSize (75,75); setLaction(); this.setSize (600,500); this.setLocationRelativeTo (null); this.setVisible (true); this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); } public void setLaction() Random r = new Random(); //x,y分别为图片(实际上是JLabel)的位置坐标 //x坐标随机数:0~525,其中525=600-75 即窗口(JFrame)宽度-组件宽度(JLabel) int x = r.nextInt (525); int y = r.nextInt (400);//因为窗口标题栏 占了些空间 所以减去了25 以保证图片完全显示 l.setLocation (x,y); this.setTitle ("Location:("+x+","+y+")"); // l.setVisible (true); } public void run() while(true) try //每个1000毫秒,随机刷新坐标,及图片每个一秒随机出现一次 Thread.sleep (1000); setLaction(); }catch(InterruptedException e) } } } public static void main(String[] args) Tt t = new Tt(); Thread tr = new Thread(t); tr.start (); } }这个很有难度 。。我记得有一款小游戏 非常牛B 是一个足球游戏就鼠标左键 就将此游戏实现传球射门带球 射门都可以用 就只是鼠标左键 。。。你可以看看这个:魔兽TD最强最难小游戏http://www.3mini.com/game/start_game.php?id=26,求一个简单又有趣的JAVA小游戏代码那你就自己做个猜数字好了import java.util.*; import java.io.*; public class CaiShupublic static void main(String[] args) throws IOExceptionRandom a=new Random(); int num=a.nextInt(100); System.out.println("请输入一个100以内的整数:"); for (int i=0;i<=9;i++)BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String str=bf.readLine(); int shu=Integer.parseInt(str); if (shu>num) System.out.println("输入的数大了 , 输小点的!"); else if (shu<num) System.out.println("输入的数小了,输大点的!"); else System.out.println("恭喜你 , 猜对了!"); if (i<=2) System.out.println("你真是个天才!"); else if (i<=6) System.out.println("还将就,你过关了!"); else if (i<=8) System.out.println("但是你还……真笨!"); else System.out.println("你和猪没有两样了!"); break;} } } }import java.util.Scanner;import java.util.Random;public class Fangfastatic int sum,sum1=0; public static void main(String [] args)int a=1,b=1,c=1; int k=0,m=1; int money =5000; int zhu =0; boolean flag = true; Random rand = new Random(); Scanner input = new Scanner(System.in); while(m==1) while(flag) System.out.println("掷色子开始!"); System.out.println("请下注注:下注金额只能是50的倍数且不能超过1000"); zhu=input.nextInt(); if(zhu%50==0&&zhu<=1000&&zhu<=money)System.out.println("下注成功");System.out.println("买大请输入数字1,买小输入数字2");k=input.nextInt();a= rand.nextInt(6)+1;b= rand.nextInt(6)+1;c= rand.nextInt(6)+1;sum=a+b+c;if(k==1)if(sum>9)money+=zhu;System.out.println("恭喜您猜对了,骰子点数为"+sum+"结果是大"+"余额为"+money);}elsemoney-=zhu;System.out.println("很遗憾,骰子点数为"+sum+"结果是小"+"余额为"+money);}}if(k==2)if(sum<=9)money+=zhu;System.out.println("恭喜您猜对了,骰子点数为"+sum+"结果是小"+"余额为"+money);}elsemoney-=zhu;System.out.println("很遗憾,骰子点数为"+sum+"结果是大"+"余额为"+money);}}flag= false;System.out.println("继续请按1,退出请按任意键");m=input.nextInt();if(m==1)flag=true;System.out.println("您选择的是继续");}elseflag=false;System.out.println("欢迎您下次再来玩");}}elseSystem.out.println("下注失败"+"余额为"+money);}} }}}import java.util.Scanner;import java.util.Random;public class Fangfastatic int sum,sum1=0; public static void main(String [] args)int a=1,b=1,c=1; int k=0,m=1; int money =5000; int zhu =0; boolean flag = true; Random rand = new Random(); Scanner input = new Scanner(System.in); while(m==1) while(flag) System.out.println("掷色子开始!"); System.out.println("请下注注:下注金额只能是50的倍数且不能超过1000"); zhu=input.nextInt(); if(zhu%50==0&&zhu<=1000&&zhu<=money)System.out.println("下注成功");System.out.println("买大请输入数字1,买小输入数字2");k=input.nextInt();a= rand.nextInt(6)+1;b= rand.nextInt(6)+1;c= rand.nextInt(6)+1;sum=a+b+c;if(k==1)if(sum>9)money+=zhu;System.out.println("恭喜您猜对了,骰子点数为"+sum+"结果是大"+"余额为"+money);}elsemoney-=zhu;System.out.println("很遗憾,骰子点数为"+sum+"结果是小"+"余额为"+money);}}if(k==2)if(sum<=9)money+=zhu;System.out.println("恭喜您猜对了,骰子点数为"+sum+"结果是小"+"余额为"+money);}elsemoney-=zhu;System.out.println("很遗憾,骰子点数为"+sum+"结果是大"+"余额为"+money);}}flag= false;System.out.println("继续请按1,退出请按任意键");m=input.nextInt();if(m==1)flag=true;System.out.println("您选择的是继续");}elseflag=false;System.out.println("欢迎您下次再来玩");}}elseSystem.out.println("下注失败"+"余额为"+money);}} }}}连连看的小源码package Lianliankan;import javax.swing.*; import java.awt.*; import java.awt.event.*; public class lianliankan implements ActionListener JFrame mainFrame; //主面板 Container thisContainer; JPanel centerPanel,southPanel,northPanel; //子面板 JButton diamondsButton[][] = new JButton[6][5];//游戏按钮数组 JButton exitButton,resetButton,newlyButton; //退出,重列,重新开始按钮 JLabel fractionLable=new JLabel("0"); //分数标签 JButton firstButton,secondButton; //分别记录两次被选中的按钮 int grid[][] = new int[8][7];//储存游戏按钮位置 static boolean pressInformation=false; //判断是否有按钮被选中 int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标 int i,j,k,n;//消除方法控制 public void init()mainFrame=new JFrame("JKJ连连看"); thisContainer = mainFrame.getContentPane(); thisContainer.setLayout(new BorderLayout()); centerPanel=new JPanel(); southPanel=new JPanel(); northPanel=new JPanel(); thisContainer.add(centerPanel,"Center"); thisContainer.add(southPanel,"South"); thisContainer.add(northPanel,"North"); centerPanel.setLayout(new GridLayout(6,5)); for(int cols = 0;cols < 6;cols++)for(int rows = 0;rows < 5;rows++ )diamondsButton[cols][rows]=new JButton(String.valueOf(grid[cols+1][rows+1])); diamondsButton[cols][rows].addActionListener(this); centerPanel.add(diamondsButton[cols][rows]); } } exitButton=new JButton("退出"); exitButton.addActionListener(this); resetButton=new JButton("重列"); resetButton.addActionListener(this); newlyButton=new JButton("再来一局"); newlyButton.addActionListener(this); southPanel.add(exitButton); southPanel.add(resetButton); southPanel.add(newlyButton); fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText()))); northPanel.add(fractionLable); mainFrame.setBounds(280,100,500,450); mainFrame.setVisible(true); } public void randomBuild() int randoms,cols,rows; for(int twins=1;twins<=15;twins++) randoms=(int)(Math.random()*25+1); for(int alike=1;alike<=2;alike++) cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); while(grid[cols][rows]!=0) cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); } this.grid[cols][rows]=randoms; } } } public void fraction()fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100)); } public void reload() int save[] = new int[30]; int n=0,cols,rows; int grid[][]= new int[8][7]; for(int i=0;i<=6;i++) for(int j=0;j<=5;j++) if(this.grid[i][j]!=0) save[n]=this.grid[i][j]; n++; } } } n=n-1; this.grid=grid; while(n>=0) cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); while(grid[cols][rows]!=0) cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); } this.grid[cols][rows]=save[n]; n--; } mainFrame.setVisible(false); pressInformation=false; //这里一定要将按钮点击信息归为初始 init(); for(int i = 0;i < 6;i++)for(int j = 0;j < 5;j++ )if(grid[i+1][j+1]==0) diamondsButton[i][j].setVisible(false); } } } public void estimateEven(int placeX,int placeY,JButton bz) if(pressInformation==false) x=placeX; y=placeY; secondMsg=grid[x][y]; secondButton=bz; pressInformation=true; } else x0=x; y0=y; fristMsg=secondMsg; firstButton=secondButton; x=placeX; y=placeY; secondMsg=grid[x][y]; secondButton=bz; if(fristMsg==secondMsg && secondButton!=firstButton)xiao(); } } } public void xiao() if((x0==x &&(y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)&&(y0==y)))remove(); } elsefor (j=0;j<7;j++ ) if (grid[x0][j]==0)if (y>j) for (i=y-1;i>=j;i-- )if (grid[x][i]!=0) k=0; break; } else} if (k==1) linePassOne(); } } if (y<j)for (i=y+1;i<=j ;i++ )if (grid[x][i]!=0)k=0; break; } else } if (k==1)linePassOne(); } } if (y==j ) linePassOne(); } } if (k==2) if (x0==x) remove(); } if (x0<x) for (n=x0;n<=x-1;n++ ) if (grid[n][j]!=0) k=0; break; } if(grid[n][j]==0 && n==x-1) remove(); } } } if (x0>x) for (n=x0;n>=x+1 ;n-- ) if (grid[n][j]!=0) k=0; break; } if(grid[n][j]==0 && n==x+1) remove(); } } } } } for (i=0;i<8;i++ ) if (grid[i][y0]==0) if (x>i) for (j=x-1;j>=i ;j-- ) if (grid[j][y]!=0) k=0; break; } else } if (k==1) rowPassOne(); } } if (x<i) for (j=x+1;j<=i;j++ ) if (grid[j][y]!=0) k=0; break; } else } if (k==1) rowPassOne(); } } if (x==i) rowPassOne(); } } if (k==2)if (y0==y) remove(); } if (y0<y) for (n=y0;n<=y-1 ;n++ ) if (grid[i][n]!=0) k=0; break; } if(grid[i][n]==0 && n==y-1) remove(); } } } if (y0>y) for (n=y0;n>=y+1 ;n--) if (grid[i][n]!=0) k=0; break; } if(grid[i][n]==0 && n==y+1) remove(); } } } } } } } public void linePassOne()if (y0>j)for (i=y0-1;i>=j ;i-- )if (grid[x0][i]!=0) k=0; break; } else } } if (y0<j)for (i=y0+1;i<=j ;i++)if (grid[x0][i]!=0) k=0; break; } else} } } public void rowPassOne()if (x0>i) for (j=x0-1;j>=i ;j-- ) if (grid[j][y0]!=0) k=0; break; } else } } if (x0<i) for (j=x0+1;j<=i ;j++ ) if (grid[j][y0]!=0) k=0; break; } else } } } public void remove()firstButton.setVisible(false); secondButton.setVisible(false); fraction(); pressInformation=false; k=0; grid[x0][y0]=0; grid[x][y]=0; } public void actionPerformed(ActionEvent e) if(e.getSource()==newlyButton)int grid[][] = new int[8][7]; this.grid = grid; randomBuild(); mainFrame.setVisible(false); pressInformation=false; init(); } if(e.getSource()==exitButton) System.exit(0); if(e.getSource()==resetButton) reload(); for(int cols = 0;cols < 6;cols++)for(int rows = 0;rows < 5;rows++ )if(e.getSource()==diamondsButton[cols][rows]) estimateEven(cols+1,rows+1,diamondsButton[cols][rows]); } } } public static void main(String[] args) lianliankan llk = new lianliankan(); llk.randomBuild(); llk.init(); } } //old 998 lines //new 318 lines停留在HelloWorld的水平 这个就比较难了你还是你弄弄数组或者list各种排序问题,比较一下效率(可以数据量大点)或者比如 输入两数字 比较大小 然后计算两数字之间的偶数和之类的吧你好!停留在HelloWorld的水平 这个就比较难了你还是你弄弄数组或者list各种排序问题 , 比较一下效率(可以数据量大点)或者比如 输入两数字 比较大小 然后计算两数字之间的偶数和之类的吧仅代表个人观点,不喜勿喷,谢谢 。