shivansh-bhatnagar18 / multiplayer-uno

https://multiplayer-uno.vercel.app
21 stars 43 forks source link

Implement throwing cards on the frontend #130

Closed kuv2707 closed 5 days ago

kuv2707 commented 2 weeks ago

Description

It would make sense to click on a card to throw it. Throwing a card just involves a function call to channel.triggerEvent.

We can add intricacies such as rearranging cards etc later on.

issue-assigner[bot] commented 2 weeks ago

Comment '@csoc-bot claim' to get this issue assigned or '@csoc-bot abandon' to get this issue unassigned.

kuv2707 commented 2 weeks ago

This issue is suitable for newcomers

draunger commented 1 week ago

@kuv2707 i did not understand the exact problem can you describe further more please

kuv2707 commented 1 week ago

@draunger We currently do not trigger the THROW_CARD event from the frontend, since we don't have any mechanism for it.

We do render JSX pertaining to each card the player has, so we can attach an event listener to the card's div, which calls channel.triggerEvent with the appropriate parameters, enabling the user to throw a card.

You can look at other places this function is used in the codebase. It is our main gateway to communicating user actions to the server.

kuv2707 commented 5 days ago

A preliminary implementation of this has been made by me