zoukankan      html  css  js  c++  java
  • dead reckoning variation

    Targeting

    A target is a structure of information that describes the state, and change of state, of an object that exists in a remote person's instance of a game.

    When you fire your laser, you send a packet of data to the server saying that

    1. You shot the laser,
    2. It was shot at some position in space (ox,oy) and
    3. that it's moving straight up.

     

    for each frame {

      target.x_velocity = target.x_velocity + target.x_acceleration;

      target.y_velocity = target.y_velocity + target.y_acceleration;

      target.z_velocity = target.z_velocity + target.z_acceleration;

     

      target.x_position = target.x_position + target.x_velocity;

      target.y_position = target.y_position + target.y_velocity;

      target.z_position = target.z_position + target.z_velocity;

        smooth();

     

    }

    smooth(){

      laser.x = (laser.x + target.x_position) / 2;

      laser.y = (laser.y + target.y_position) / 2;

      laser.z = (laser.z + target.z_position) / 2;

    }

     

    smooth2(){

      laser.x = (laser.x * 99 + target.x_position) / 100;

      laser.y = (laser.y * 99 + target.y_position) / 100;

      laser.z = (laser.z * 99 + target.z_position) / 100;

    }

  • 相关阅读:
    jQueryEasyUI
    AJAX
    SWFUpload批量上传插件
    jQuery工具函数
    jQuery之Jcrop
    jQuery插件之jqzoom
    jQuery插件之artDialog
    jQuery插件之ajaxFileUpload
    jQuery插件之Cookie
    jQuery插件之Form
  • 原文地址:https://www.cnblogs.com/lightlfyan/p/4203885.html
Copyright © 2011-2022 走看看