我遇到了一个问题,因为我的缓冲区,我的播放器对象在跳跃时总是跳到最大高度。这是我的第一场比赛,所以我在玩 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