感谢世外苏子恒同学提供
 
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. movebase导航

    利用turtlebot 的导航配置文件 由于movbase发的速度太不友好了所以使用了ros自带的滤波安装相应的包 apt-get install ros-indigo-yocs-velocity-s ...

  2. Hibernate 检索策略

    概述 检索数据时的 2 个问题: –不浪费内存:当 Hibernate 从数据库中加载 Customer 对象时, 如果同时加载所有关联的 Order 对象, 而程序实际上仅仅需要访问 Custome ...

  3. CodeForces 688A-Opponents

    题意: Arya在学校有n个敌人(一串含有0,1的数字表示),有一个游戏规则,如果当天这n个敌人全部出席("1"代表出席,),即这串数字全部为"1",则Arya ...

  4. eclipse快捷键用不了

    ctrl+shift+R是eclipse最常用的快捷键之一,用于打开资源,输入文件名或文件名中的前几个字母,就可以打开工作区中任意文件 今天在打开eclipse,使用该快捷键时,提示“该快捷方式所指向 ...

  5. iOS7程序内部如何打开评分页面

    测试发现项目在iOS7下 无法打开评价页面,但是iOS6是正常: 查了一下发现应该是iOS7 改变链接了,有个网友给出了以下的解决办法 把旧的链接改成 appString =[NSStringstri ...

  6. Jmeter—8 连接microsoft sql server数据库取数据

    本文以Jmeter 连接microsoft sql server为例. 1 从微软官网下载Microsoft SQL Server JDBC Driver 地址:http://www.microsof ...

  7. 两个小的java程序,用于练习java基本语法

    1.输入两个数,求其加减乘除.用窗口的形式呈现 import javax.swing.JOptionPane; public class JJCC { public static void main( ...

  8. Android Studio实现页面跳转(新页面或者网站)

    一,跳转到另一个页面 百度了好久,好像好多种方法,从中挑选了一中比较方便的一中方法 利用Intent类进行实现 1,首先在firstActivity中添加相应的跳转命令代码 例如一下示例代码 if ( ...

  9. IOS 使用FMDB多线程访问数据库 及databaseislocked的问题

    原理:文件数据库sqlite,同一时刻允许多个进程/线程读,但同一时刻只允许一个线程写.在操行写操作时,数据库文件被琐定,此时任何其他读/写操作都被阻塞,如果阻塞超过5秒钟(默认是5秒,能过重新编译s ...

  10. iOS 动画 旋转 移动简单代码

    #import "ViewController.h" @interface ViewController () { UIImageView *imgView; BOOL flag; ...