更新时间:2023-02-02 18:47:10
有关你的游戏,我想你只需要玩家跳跃时空间pressed的和的时候,玩家就地上。然后,必须检查球员在场上有期望的行为。
For your game, I think you only want the player to jump whenever space is pressed and when the player is on the floor. You must then check if the player is on the floor to have the desired behavior.
我建议你的设备是这样一种机制:
I suggest you device a mechanism like this:
if (this->keyPressed(SDLK_SPACE) && this->isOnTheFloor()) {
^^^^^^^^^^^^^^^^^^^^^^^
mov->jump(); // Changes the velocity in Y
}