Created
October 1, 2021 08:43
-
-
Save ajeetraina/e72de13a119780e503654d470f7fb88d to your computer and use it in GitHub Desktop.
Player Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def click(self, game_id, user_id, x, y, o): | |
""" | |
Handle player main key pressed event. | |
""" | |
player = self.games_states[game_id]["players"][user_id] | |
self.games_states[game_id]["projectiles"].append({ | |
"timestamp": self.ts, # server time | |
"x": player["x"] if player['x'] is not None else 9999, | |
"y": player["y"] if player['y'] is not None else 9999, | |
"orientation": o, # radians | |
"ttl": 2000, # ms | |
"speed": 1, # px/ms | |
"user_id": user_id | |
}) | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment