oh my GOD pleqase play this version it is so funny

This commit is contained in:
gallant 2023-02-12 21:03:08 -06:00
parent e8a1740ed9
commit 1724e67dad

View file

@ -64,7 +64,7 @@ fn main() {
dir_enemy = Direction::Up; dir_enemy = Direction::Up;
} }
if now.elapsed().as_millis() >= 110 { if now.elapsed().as_millis() >= 10 {
if check_for_collision(&paddle, &ball.sprite) { if check_for_collision(&paddle, &ball.sprite) {
if dir == Direction::Up { if dir == Direction::Up {
ball.vel_y += 1; ball.vel_y += 1;
@ -85,20 +85,22 @@ fn main() {
ball.vel_x *= -1; ball.vel_x *= -1;
ball.vel_y *= -1; ball.vel_y *= -1;
} }
if y_ball == 0 || y_ball == 500 if y_ball < 0 || y_ball > 500
{ {
ball.vel_y *= -1; ball.vel_y *= -1;
} }
if x_ball == 0 || x_ball == 500 if x_ball < 0 || x_ball > 500
{ {
ball.sprite.set_position((250,250)); ball.sprite.set_position((250,250));
ball.vel_x *= -1; ball.vel_x = ball.vel_x * -1 - 1;
ball.vel_y = ball.vel_y * -1 - 1;
} }
ball.sprite.translate((ball.vel_x, ball.vel_y)); ball.sprite.translate((ball.vel_x, ball.vel_y));
} }
if now.elapsed().as_millis() >= 120 { if now.elapsed().as_millis() >= 10 {
if (y_enemy - CORNER) < 0 { if (y_enemy - CORNER) < 0 {
dir_enemy = Direction::Still; dir_enemy = Direction::Still;
paddle_enemy.set_position((x_enemy, 1 + CORNER)); paddle_enemy.set_position((x_enemy, 1 + CORNER));
@ -109,15 +111,15 @@ fn main() {
match dir_enemy { match dir_enemy {
Direction::Up => { Direction::Up => {
paddle_enemy.translate((0, 25)); paddle_enemy.translate((0, 2));
} }
Direction::Down => { Direction::Down => {
paddle_enemy.translate((0, -25)); paddle_enemy.translate((0, -2));
} }
_ => (), _ => (),
}; };
} }
if now.elapsed().as_millis() >= 120 { if now.elapsed().as_millis() >= 10 {
if (y_player - CORNER) < 0 { if (y_player - CORNER) < 0 {
dir = Direction::Still; dir = Direction::Still;
paddle.set_position((x_player, 1 + CORNER)); paddle.set_position((x_player, 1 + CORNER));
@ -128,10 +130,10 @@ fn main() {
if held { if held {
match dir { match dir {
Direction::Up => { Direction::Up => {
paddle.translate((0, 25)); paddle.translate((0, 2));
} }
Direction::Down => { Direction::Down => {
paddle.translate((0, -25)); paddle.translate((0, -2));
} }
_ => (), _ => (),
}; };