游戏跳跃

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
jump() {
  this.speedY = this.jumpSpeed;
},

update(dt) {
  if (this.state != STATE.NONE || this.state != STATE.DEAD) {
    this.speedY -= this.g//正到负
      this.node.y += this.speedY//跳起时加的speedY值越来越小,speedY为负后开始下落且越来越快
      if (this.node.y < -440) {
          this.node.y = -440;
      }
      if (this.node.y > 420) {
          this.node.y = 420;
      }
  }
}
作者

DullSword

发布于

2019-03-04

更新于

2024-07-02

许可协议

评论