Giter Site home page Giter Site logo

Comments (3)

JeffWGL avatar JeffWGL commented on September 18, 2024

同问,以及最新的规则是球拍具有移动速度限制吗?如果是这样的话,是按照球拍瞬移有一定的距离范围处理吗?

from pingpong.sessdsa.

chbpku avatar chbpku commented on September 18, 2024

已改为仅包含方向:

        dict_op_side = {'position': copy.copy(op_player.pos),
                        'life': op_player.life,
                        'accelerate': -1 if op_player.action.acc < 0 else 1,
                        'run_vector': -1 if op_player.action.run < 0 else 1}

from pingpong.sessdsa.

chbpku avatar chbpku commented on September 18, 2024

移动速度限制已经设定:

    def get_velocity(self):
        # 球拍的全速是球X方向速度,按照体力值比例下降,当体力值下降到55%,将出现死角
        return int((self.life / RACKET_LIFE) * BALL_V[1])

    def update_pos_bat(self, tick_step):
        # 如果指定迎球的距离大于最大速度的距离,则采用最大速度距离
        self.pos.y += sign(self.action.bat) * min(abs(self.action.bat), self.get_velocity() * tick_step)
        # 减少生命值
        self.life -= int((abs(self.action.bat) / FACTOR_DISTANCE) ** 2)

    def update_pos_run(self, tick_step):
        # 如果指定跑位的距离大于最大速度的距离,则采用最大速度距离
        self.pos.y += sign(self.action.bat) * min(abs(self.action.run), self.get_velocity() * tick_step)
        # 减少生命值
        self.life -= int((abs(self.action.run) / FACTOR_DISTANCE) ** 2)

@JeffWGL

from pingpong.sessdsa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.