zurda / hangman-films

Hangman game: guess the film (movieDB API, Typescript, React)
https://hangman-films.netlify.app/
6 stars 6 forks source link

Hint feature improvements #17

Closed zurda closed 4 years ago

zurda commented 4 years ago

Purpose

Improve Hint feature

Current behaviour:

When you click the hint button, you get a part of the movie poster displayed in the UI. If the movie poster hint isn't helpful, we should allow the user to get another movie poster for 1 guess.

Screenshot 2020-10-13 at 16 31 08 Screenshot 2020-10-13 at 16 31 21

First suggestion:

So, if getting the hint (movie poster) "costs" the user 2 guesses, then getting another movie poster should "cost" one guess.

Once the user requested another hint, we need to randomly select and display another section of the movie poster.

Second suggestion:

Right now the movie poster hint always show the top left corner of the poster. We should randomally choose a section of the poster to improve the users chances

Feel free to create a PR for either of these suggestions, or two PR for each (you don't have to do both).

miguelcarvalho13 commented 4 years ago

Hi! Can I work on this issue?

zurda commented 4 years ago

Sure thing, @miguelcarvalho13 . Worth noting that we've changed the styling so I updated the visuals and description in this ticket.

I edited the description, so now there are 2 suggestions on how the hint feature could be improved. Feel free to only do one or the other. If you do both suggestions - feel free to do them in seperate PRs.

I hope this makes sense?

miguelcarvalho13 commented 4 years ago

Thanks! It totally makes sense! I'll try to do both and I think I'm going to start with the option of Change hint location so it doesn't always get the top left corner.

I'm a bit new to react so if I need help I'll get back to here 😄

zurda commented 4 years ago

Sure thing, and no worries. Let me know if you need help, and we can figure it out together. There's probably more than one way to do this (to be honest, I feel like I initially put a randomiser to the location of the hint so not sure if it never worked or if it stopped working at some point 😂)

miguelcarvalho13 commented 4 years ago

(to be honest, I feel like I initially put a randomiser to the location of the hint so not sure if it never worked or if it stopped working at some point 😂)

I totally know that feeling 🤣

I didn't found a randomizer for the hint already in the code but I actually found a function that gets a random number (getRandom) and did this PR https://github.com/zurda/hangman-react/pull/24 using that function.

Something that I didn't understand was that there was a component called PosterHint.tsx but it didn't seem to be used so the place I changed was inside the GameBoard.tsx

zurda commented 4 years ago

Oh, that's a good point @miguelcarvalho13 , thanks for letting me know. There might be some cleaning up needed - I'll add an issue for cleaning up unused libraries/ unused components.

And thank you for the PR - works like a charm. I'm leaving this open for the second subtask

miguelcarvalho13 commented 4 years ago

Thank you! 🎉 I'll try to work on the second one (Add ability to get a second hint)

miguelcarvalho13 commented 4 years ago

Just tried to do the second one in this PR https://github.com/zurda/hangman-react/pull/28 Let me know if there's something to change 😄

zurda commented 4 years ago

Looks great, thanks for contributing 🙌

miguelcarvalho13 commented 4 years ago

Thank you too!! 🤗