.
Код: Выделить всё
class Player {
public:
float speed = 2.0f;
float velocityY = 0.0f;
float jumpForce = -10.0f;
float coefficientOfElasticity = 0.2f;
float jumpBufferTime = 0.0f;
float maxJumpHeight = 150.0f;
bool onGround = false;
Rectangle body;
float dashSpeed = 400.0f;
float dashDuration = 0.1f;
float dashCooldown = 1.0f;
float dashTimer = 0.0f;
float lastDashTime = 0.0f;
Vector2 dashStart;
Vector2 dashEnd;
bool isDashing=false;
Player(float x, float y, float w, float h) {
body = {x, y, w, h};
}
void draw() {
DrawRectangleRounded(body, 1, 1, Color({238, 235, 211, 155}));
}
void handleControl() {
if(!isDashing){
if (IsKeyDown(KEY_A)) { body.x -= speed; }
if (IsKeyDown(KEY_D)) { body.x += speed; }
}
if (IsKeyPressed(KEY_SPACE) && (onGround || jumpBufferTime > 0) && body.y >= maxJumpHeight) {
velocityY = jumpForce;
onGround = false;
}
if (IsKeyPressed(KEY_E)) {
std::cout 0) && body.y >= maxJumpHeight) {
velocityY = jumpForce;
onGround = false;
}
if (IsKeyPressed(KEY_E)) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79506436/multiple-keyboard-key-input-in-raylib[/url]