dos窗口 对球的移动
来源:互联网 发布:nginx 目录配置 编辑:程序博客网 时间:2024/06/05 01:00
#include <graphics.h>
#include <conio.h>
void main()
{
char c = 0;
int x = 320,y=240;
initgraph(640, 480);
setfillcolor(CYAN);
setlinecolor(BLUE);
fillcircle(x, y, 50);
while (c != 27)
{
c = _getch();
setlinecolor(BLACK);
setfillcolor(BLACK);
fillcircle(x, y, 50);
switch (c)
{
//按键 W A S D 移动
case 'a': x -= 5; break;
case 'd': x += 5; break;
case 'w': y -= 5; break;
case 's': y += 5; break;
//jump 往上一直移动到边界
case 'j': while (y -50> 0)
{
setlinecolor(BLACK);
setfillcolor(BLACK);
fillcircle(x, y, 50);
y--;
setfillcolor(CYAN);
setlinecolor(BLUE);
fillcircle(x, y, 50);
Sleep(10);
} break;
default:
break;
}
if (x - 50 < 0)
x += 5;
if (x + 50 > 640)
x -= 5;
if (y - 50 < 0)
y += 5;
if (y + 50 > 480)
y -= 5;
setfillcolor(CYAN);
setlinecolor(BLUE);
fillcircle(x, y, 50);
Sleep(10);
}
closegraph();
}
#include <conio.h>
void main()
{
char c = 0;
int x = 320,y=240;
initgraph(640, 480);
setfillcolor(CYAN);
setlinecolor(BLUE);
fillcircle(x, y, 50);
while (c != 27)
{
c = _getch();
setlinecolor(BLACK);
setfillcolor(BLACK);
fillcircle(x, y, 50);
switch (c)
{
//按键 W A S D 移动
case 'a': x -= 5; break;
case 'd': x += 5; break;
case 'w': y -= 5; break;
case 's': y += 5; break;
//jump 往上一直移动到边界
case 'j': while (y -50> 0)
{
setlinecolor(BLACK);
setfillcolor(BLACK);
fillcircle(x, y, 50);
y--;
setfillcolor(CYAN);
setlinecolor(BLUE);
fillcircle(x, y, 50);
Sleep(10);
} break;
default:
break;
}
if (x - 50 < 0)
x += 5;
if (x + 50 > 640)
x -= 5;
if (y - 50 < 0)
y += 5;
if (y + 50 > 480)
y -= 5;
setfillcolor(CYAN);
setlinecolor(BLUE);
fillcircle(x, y, 50);
Sleep(10);
}
closegraph();
}
0 0
- dos窗口 对球的移动
- 关闭DOS窗口的代码
- 去掉恼人的dos窗口
- 隐藏DOS窗口 的方法
- 关于Dos窗口的设置
- 打开dos窗口的快捷键
- DOS窗口双引号的作用
- 如何用dos窗口对Android内置的SQLite数据库进行操作
- 使用自定义窗口以及对窗口的移动,缩放,关闭操作
- Adobe AIR迷你教程 — 使用自定义窗口以及对窗口的移动,缩放,关闭操作
- Adobe AIR迷你教程 -- 使用自定义窗口以及对窗口的移动,缩放,关闭操作
- 无标题窗口的移动
- 无标题窗口的移动
- 窗口的移动!
- 移动窗口的快捷键
- 移动窗口的脚本
- dos 对字符串的处理
- 执行dos命令,不出现黑色的dos窗口
- c# HttpWebRequest post和get请求http
- Valid Number
- 第109讲:Akka中的Actor异步和同步停止方式实战详解学习笔记
- CentOS下配置iptables防火墙
- 字符串的替换
- dos窗口 对球的移动
- 程序运行状态的判定
- maven的dependency之optional属性
- Spring事务编写
- Android 开源框架Universal-Image-Loader完全解析(一)--- 基本介绍及使用
- ListView 或GridView不能响应itemclick事件的解决方法
- Windows Azure® 由世纪互联运营发布MySQL Database on Azure正式商用版
- nasm : dump memory to file on bochsdbg
- 取到字符串的指定下标的字符