- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
switch (player->collision(pos, getRadius()))
{
case SIDE_UP:
ySpeed = -player->baseSpeed.y + player->currentSpeed.y;
xSpeed = xSpeed - player->currentSpeed.x;
if (abs(xSpeed) > maxXSpeed)
xSpeed = maxXSpeed * (xSpeed < 0 ? -1 : 1);
break;
case SIDE_DOWN:
setPosition(getPosition().x, getPosition().y - getRadius() * 2 - 20);
ySpeed = -player->baseCornerSpeed.y - player->currentSpeed.y;
xSpeed = xSpeed - player->currentSpeed.x;
if (abs(xSpeed) > maxXSpeed)
xSpeed = maxXSpeed * (xSpeed < 0 ? -1 : 1);
break;
case SIDE_RIGHT:
case SIDE_LEFT:
xSpeed = -xSpeed + player->currentSpeed.x;
break;
case CORNER_LEFT_UP:
ySpeed = -player->baseCornerSpeed.y;
xSpeed = -player->baseCornerSpeed.x;
break;
case CORNER_RIGHT_UP:
ySpeed = -player->baseCornerSpeed.y;
xSpeed = player->baseCornerSpeed.x;
break;
case CORNER_RIGHT_DOWN:
ySpeed = player->baseCornerSpeed.y;
xSpeed = player->baseCornerSpeed.x;
break;
case CORNER_LEFT_DOWN:
ySpeed = player->baseCornerSpeed.y;
xSpeed = -player->baseCornerSpeed.x;
break;
}
Комментарии (0) RSS
Добавить комментарий