Skip to content

Instantly share code, notes, and snippets.

@ajeetraina
Created October 1, 2021 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajeetraina/e72de13a119780e503654d470f7fb88d to your computer and use it in GitHub Desktop.
Save ajeetraina/e72de13a119780e503654d470f7fb88d to your computer and use it in GitHub Desktop.
Player Functions
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