⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coordstomoveby.cpp

📁 symbian 的一个 二维飞行游戏 源码 及相关技术文章
💻 CPP
字号:
#include <iostream>
#include <fstream>


void main() {
  while(cin) {
    int i=0;
    int lastx=0,lasty=0;
    cin >> lastx;
    cin >> lasty;
    lastx/=2;
    cout << "MoveTo " << lastx << "," << lasty << "\n";
    int x,y;
    cin >> x >> y;
    x /=2;
    while(cin && x != -1) {
      int diffx=x-lastx;
      int diffy=y-lasty;

      int diffx_step1 = diffx/2;
      int diffx_step2 = diffx_step1-(diffx_step1/2);
      diffx_step1 = diffx_step1/2;
      int diffx_step3 = diffx-(diffx/2);
      int diffx_step4 = diffx_step3-(diffx_step3/2);
      diffx_step3 = diffx_step3/2;

      int diffy_step1 = diffy/2;
      int diffy_step2 = diffy_step1-(diffy_step1/2);
      diffy_step1 = diffy_step1/2;
      int diffy_step3 = diffy-(diffy/2);
      int diffy_step4 = diffy_step3-(diffy_step3/2);
      diffy_step3 = diffy_step3/2;

      cout << "EPathLineMoveBy,1," << diffx_step1 << "," << diffy_step1<< "\n";
      cout << "EPathLineMoveBy,1," << diffx_step2 << "," << diffy_step2<< "\n";
      cout << "EPathLineMoveBy,1," << diffx_step3 << "," << diffy_step3<< "\n";
      cout << "EPathLineMoveBy,1," << diffx_step4 << "," << diffy_step4<< "\n";
      lastx=x;
      lasty=y;
      cin >> x >> y;
      x /=2;
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -