感谢世外苏子恒同学提供
 
uses crt;
var
  x,y,xd,yd,xb,yb:shortint;
  k:char;
procedure intro;
begin
  clrscr;
  writeln;
  writeln;
  writeln;
  writeln;
  writeln;
  writeln('Naughty ball-II':48);
  writeln('--by suziheng':47);
  writeln;
  writeln;
  writeln('Use A(left) and D(right) to controll the board"=========="':69);
  writeln;
  writeln;
  writeln('If the ball falls down below the screen, GAMEOVER!':65);
  writeln;
  writeln;
  writeln('Press CTRL+C to exit':50);
  writeln;
  writeln;
  writeln('Press Enter to start':50);
  readln;
end;
 
procedure gameover;
begin
 clrscr;
 writeln;
 writeln;
 writeln;
 writeln;
 writeln('GAME OVER':45);
 writeln;
 writeln;
 writeln('                                   -------------');
 writeln('                               O <  why  didn',chr(39),'t |'); 
 writeln('                                  | you  lift   |');
 writeln('                                  | me  up !!?? |');
 writeln('                                   -------------');
 delay(10000);
 exit;
end;
 
begin
  cursoroff;
  intro;
 
  xb:=1;
  yb:=24;
  xd:=1;
  yd:=1;
  x:=2;
  y:=2;
 
  while true do begin
    clrscr;
    x:=x+xd;
    y:=y+yd;
    gotoxy(x,y);
    write('O');
    if keypressed then begin
      k:=readkey;
      if (k='a') and (xb>10) then xb:=xb-10;
      if (k='d') and (xb<60) then xb:=xb+10;
    end;
    gotoxy(xb,yb);
    write('====================');
 
    delay(100);
    if (x=80) or (x=1) then xd:=-xd;
    if y=1 then yd:=-yd;
    if (y=yb) and ((x>=xb) and (x<=xb+19)) then begin
      sound(1);
      delay(50);
      nosound;
      yd:=-yd;
    end;
    if y=25 then break;
  end;
  gameover;
end.

顽皮的小球II的更多相关文章

  1. Pascal语言(存档)

    数据类型 标准函数 运算符和表达式 输入语句 输出语句 if语句 case语句 for语句 while语句 repeat语句 函数与过程 形参与实参 全局变量与局部变量 数组 字符串 枚举 子界 集合 ...

  2. HTML5CSS3特效-上下跳动的小球-遁地龙卷风

    (-1)写在前面 我用的是chrome49,这个idea是我在stackoverflow上回答问题时看到了,多谢这位同行,加深了我对很多技术点的理解,最近刚到北京,忙碌了一两天,在后续的日子里,会被安 ...

  3. Leetcode 笔记 113 - Path Sum II

    题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...

  4. Leetcode 笔记 117 - Populating Next Right Pointers in Each Node II

    题目链接:Populating Next Right Pointers in Each Node II | LeetCode OJ Follow up for problem "Popula ...

  5. 函数式Android编程(II):Kotlin语言的集合操作

    原文标题:Functional Android (II): Collection operations in Kotlin 原文链接:http://antonioleiva.com/collectio ...

  6. 统计分析中Type I Error与Type II Error的区别

    统计分析中Type I Error与Type II Error的区别 在统计分析中,经常提到Type I Error和Type II Error.他们的基本概念是什么?有什么区别? 下面的表格显示 b ...

  7. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  8. [LeetCode] Guess Number Higher or Lower II 猜数字大小之二

    We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to gues ...

  9. [LeetCode] Number of Islands II 岛屿的数量之二

    A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand oper ...

随机推荐

  1. Zabbix汉化方法

    1.windows下选择一个汉化字体包 2.拷贝到linux字体目录下 [root@www Desktop]# cd /var/www/html/zabbix/fonts/[root@www font ...

  2. asp.net mvc处理css和js版本问题

    当服务的修改了js和css内容后,发布到IIS服务器上,总是导致客户端内容显示不正确,原因是客户端存在缓存,还是加载的原来的js和css问题. 在css或js后面添加版本号,例如: <scrip ...

  3. C++ STL算法系列2---find ,find_first_of , find_if , adjacent_find的使用

    一.find运算 假设有一个int型的vector对象,名为vec,我们想知道其中是否包含某个特定值. 解决这个问题最简单的方法时使用标准库提供的find运算: 1 // value we'll lo ...

  4. Service中事务不能回滚的解决方式(转)

    1.在service方法里面如果对异常进行了捕获的话,该事务是不会进行回滚的        默认spring事务只在发生未被捕获的 runtimeexcetpion时才回滚.          spr ...

  5. 集合ArrayList

    /*集合ArrayList * 例如: * 1.创建:ArrayList<Egg> myList = new ArrayList<Egg>(); *      Egg类型的集合 ...

  6. QT中QWS的含义 (转至 宋金时的专栏

    QT 编程和文档中的术语QWS的全称是Qt windows system,是QT自行开发的窗口系统,体系结构类似X Windows,是一个C/S结构,由QWS Server在物理设备上显示,由QWS ...

  7. linux命令:find

    1.命令介绍: find用来在整个系统指定的路径下搜索文件,功能强大,但是遍历整个系统时很耗时间. 2.命令格式: find 路径 [选项] [print -exec -ok...] 3.命令参数: ...

  8. html5有哪些新特性、移除了那些元素?如何处理HTML5新标签的浏览器兼容问题?如何区分 HTML 和 HTML5?

    * HTML5 现在已经不是 SGML(标准通用标记语言,是一种定义电子文档结构和描述其内容的国际标准语言) 的子集,主要是关于图像,位置,存储,多任务等功能的增加.   * 拖拽释放(Drag an ...

  9. HTTP通信原理

    HTTP(HyperText Transfer Protocol)是一套计算机通过网络进行通信的规则.计算机专家设计出HTTP,使HTTP客户(如Web浏览器)能够从HTTP服务器(Web服务器)请求 ...

  10. For xml path

    Select * from tb for xml path('') 特点: 1. 以xml形式展示查询数据. 2. 自定义数据展示类型. 实例: 1. Select * from tb for xml ...