【问题标题】:Jump buffer not playing nice with variable jumping跳转缓冲区不能很好地与变量跳转
【发布时间】:2020-04-06 12:06:14
【问题描述】:

我遇到了一个问题,即我的玩家对象在跳跃时总是因为我的缓冲区而跳到最大高度。这是我的第一场比赛,所以我在玩 Heartbeast 的引擎。我想我遗漏了一些相当明显的东西,希望大家能提供帮助!

这是我在跳跃动作脚本中使用的内容:


///enable_movement_jump(height, input, release_input)
/*
    Call this script to enable platform jumping
    on a movement entity.
*/

var height = argument[0]; // The jump height (Should be positive)
var input = argument[1]; // The input for jumping
var release_input = argument[2]; // The input for jump height control (release)
var coyoteFrames = 10; // The grace period, in frames, for coyote time
var jumpBufferFrames = 10; // The buffer, in frames, for the jump buffer

// Check for ground collision
if (place_meeting(x, y+1, collision_object) || place_meeting(xprevious, yprevious+1, collision_object)) {
    coyoteTimer = 0; // Reset coyote timer
    if ((input) || (jumpBufferTimer < jumpBufferFrames))
    {
        vsp[0] = -height;
        coyoteTimer = coyoteFrames; // Max coyote timer
        jumpBufferTimer = jumpBufferFrames; // Max buffer timer
    }

} else {
    if (input)
    {
        jumpBufferTimer = 0; // Reset buffer timer
        if (coyoteTimer < coyoteFrames) // During coyote time
        {
            vsp[0] = -height;
            coyoteTimer = coyoteFrames; // Max coyote timer
            jumpBufferTimer = jumpBufferFrames; // Max buffer timer
        }
    }
    if (release_input && vsp[0] <= -height/3) {
        vsp[0] = -height/3;
    }
}

++coyoteTimer; // Increase coyote
++jumpBufferTimer; // Increase buffer

【问题讨论】:

  • 我认为这与 release_input 未触发有关?

标签: game-maker gml game-maker-language


【解决方案1】:

当你落地时,你重置了coyoteTimer,但是你把jumpBufferTimer放在了不同的条件下,也许在相同的条件下这些应该设置为0?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-11
    • 1970-01-01
    • 1970-01-01
    • 2015-08-25
    相关资源
    最近更新 更多