查看: 2489|回复: 2

[已经过期] 如何能让插件在游戏中通过事件控件ON 或OFF

[复制链接]
梦石
0
星屑
801
在线时间
108 小时
注册时间
2016-7-9
回帖
28
发表于 2017-9-3 00:20:35 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
游戏前期用不到那个插件,后期再用 有什么办法控制它的打开或者关闭吗..因为插件里没有开关的功能命令
..所以不知道怎么关掉它 等用到时才通过事件命令开启
梦石
0
星屑
801
在线时间
108 小时
注册时间
2016-7-9
回帖
28
 楼主| 发表于 2017-9-3 00:43:04 | 显示全部楼层
// 方向
  Game_Player.prototype.moveByInput = function() {
    if (this._ladder) {
      if (Input.isPressed('up')) {
        this.setDirection(8);
        this._vy = Math.max(this._vy - this._ladderAccele, -this._ladderSpeed);
        this._moveCount = 4;
        this.resetStopCount();
      } else if (Input.isPressed('down')) {
        this.setDirection(8);
        this._vy = Math.min(this._vy + this._ladderAccele, this._ladderSpeed);
        this._moveCount = 4;
        this.resetStopCount();
      }
      if (!this.isCollideLadder(false)) {
        this.getOffLadder();
      }
    } else {
      if (!this.isDashing()) {
        if (Input.isPressed('left')) {
          var speed = this.isGuarding() ? -this._moveSpeed * actGuardMoveRate / 100 : -this._moveSpeed;
          this.setDirection(4);
          if (this._vx > speed) {
            var accele = Math.max(this._accele - this._friction, 0);
            this._vx = Math.max(this._vx - accele, speed);
          }
          this._moveCount = 4;
        } else if (Input.isPressed('right')) {
          var speed = this.isGuarding() ? this._moveSpeed * actGuardMoveRate / 100  : this._moveSpeed;
          this.setDirection(6);
          if (this._vx < speed) {
            var accele = Math.max(this._accele - this._friction, 0);
            this._vx = Math.min(this._vx + accele, speed);
          }
          this._moveCount = 4;
        }
      }
      if (Input.isPressed('up')) {
        if (this.isCollideLadder(false)) this.getOnLadder(false);
      } else if (Input.isPressed('down')) {
        if (this.isCollideLadder(true)) this.getOnLadder(true);
      }
    }
  };
这段 代码要加入 个控制 插件开关  应该在么写
回复

使用道具 举报

梦石
0
星屑
50
在线时间
10 小时
注册时间
2017-5-9
回帖
2
发表于 2017-9-5 15:30:07 | 显示全部楼层
游戏插件plugin文件是在游戏开始的时候,被程序读取转换。
所以加什么控制开关都是无效的。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部