mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2026-02-04 11:40:25 +01:00
working to improve the bot
This commit is contained in:
parent
a5ffbe07d7
commit
fac44553e6
@ -73,7 +73,6 @@ class Game:
|
|||||||
|
|
||||||
async def update_bot_position(self):
|
async def update_bot_position(self):
|
||||||
#future_ball_position = self.predict_ball_trajectory()
|
#future_ball_position = self.predict_ball_trajectory()
|
||||||
|
|
||||||
target_y = self.future_ball_position['y']
|
target_y = self.future_ball_position['y']
|
||||||
player2_position = self.game_state['player2_position']
|
player2_position = self.game_state['player2_position']
|
||||||
|
|
||||||
@ -101,9 +100,9 @@ class Game:
|
|||||||
future_x = 790
|
future_x = 790
|
||||||
else:
|
else:
|
||||||
future_y += velocity_y
|
future_y += velocity_y
|
||||||
# Dealing with bounces off walls
|
# Dealing with bounces off walls
|
||||||
if future_y <= 10 or future_y >= 390:
|
if future_y <= 10 or future_y >= 390:
|
||||||
velocity_y = -velocity_y # Reverse the direction of vertical movement
|
velocity_y = -velocity_y # Reverse the direction of vertical movement
|
||||||
return {'x': future_x, 'y': future_y}
|
return {'x': future_x, 'y': future_y}
|
||||||
|
|
||||||
async def update_game_state(self):
|
async def update_game_state(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user