Hangman Game for Android build with Compose

Overview

🎮 Hangman - Built With Compose 🖌️

Thanks to Cicero Hellmann For giving this cool idea to build Hangman game with Compose for Android.

Game Banner

?? What's New: v0.1.0

  • Players will be challenged with unique words only.
  • Players can view their score/game history.
  • Players should know how many unique words can still guess.
  • Players can see how many attempts they have to guess the word.
  • Players can try out letters in any order they want.
  • Players can to know how many points made when I completed a word.
  • Players can to know how many points scored by completing all levels.
  • Persist the game state at any point of the game.

🎢 Roadmap: v0.2.0

  • Support game in landscape mode.
  • Add more guessing categories.
  • Players can have hints for each level.
  • Improve game user experience.
  • Fix issues for smaller screen devices.
  • Replace all Shared Preferences with DataStore.

🍡 App Overview

Screen Red Theme Teal Theme
OnBoarding Screen

• Default destination for the app.
• Players can choose different game categories from dialog.
• Players can choose difficulty mode through slider.
• Highest score will automatically update from game history data.
• Players can mute/unmute game background music.
• Players can read the game instructions from dialog.
• Shared preferences are used to save game category and difficulty.
Game Screen

• Destination for playing the game.
• Game loads with default game preferences last saved by the player.
• Players can check their points and current level.
• Players can view the number of attempts left to guess the word.
• Once player completes all levels, a dialog will show up with total points scored.
• At any level if player loses the game, dialog will be shown with word which isn't guessed correctly.
• Can access the game instructions dialog to see which game mode is running.
• Players cannot reuse the same letter which is already guessed.
• Players cannot directly exit the game, a modal sheet will confirm the exit.
• Players can view which letters are correctly being guessed.
History Screen

• Players can see their whole game history.
• Made use of room database to store all the history data.
• Each game history item has properties overall score, category, difficulty, level, won/lost info, time/date of play will be saved.
• Any specific game item history can be deleted from database by swiping.
• When no history is available a simple text message will be shown.
• Game progress will be saved only when player loses or wins but not when exits.
Adjust Difficulty Mode Game Instructions Game Exit Modal Sheet
Game Won Dialog Game Lost Dialog Game Exit

Experiencing slow game performance ?

Rendering times with Compose is slower compared to XML. I've added few references below which could help you improve app performance.

  • Change app module to choose build variant Release mode.
  • Enable R8 and disable debug to speed up the performance

References 📑

🎃 Teal/Red Theme Colors

val TealColorPalette = lightColors(
  primary = tealPrimary,
  background = tealBackground,
  onBackground = tealOnBackground,
  surface = tealSurface,
  onSurface = tealOnSurface
)

val RedColorPalette = darkColors(
  primary = redPrimary,
  background = redBackground,
  onBackground = redOnBackground,
  surface = redSurface,
  onSurface = redOnSurface
)

💡 Motivation and Context

Jetpack Compose is Android’s modern toolkit for building native UI. It enables you to quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs.

Understanding to implement own Theme Shape Typography Color has became bit easier by referring to lot of official jetpack compose samples which are available in GitHub.

Best of all we got to do this in Kotlin way. Excited and long way to go from here.

📢 What To Contribute ?

  • Have a cool idea or feature request? Start a discussion.
  • Want to contribute or add new feature to app? Send your pull request.
  • Game crashes while playing? Open a new issue, describe the problem.

🏆 Credits

🔊 Game Sounds - Pixabay.com

PIXABAY LICENSE CERTIFICATE

All sounds used in game are only for user experience purpose.
I do not own any of those audio content. All credit belongs to Music Author
uploaded to Pixabay.

I hold the licenses for audio files used in this app. Verify all license certificates.

✒️ Creepster Font

This fonts is licensed under the Open Font License, this is the only font I've used in my app.

You can refer to this font from Google Fonts.

👾 Icons

For the background images I have used in game, I have modified and used few icons from unDraw and iconscout.

📜 License

Copyright 2022 Rajasekhar K E

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Recomposition won't take place when state changes.

    Recomposition won't take place when state changes.

    Issue

    Initially recomposition won't happen once value changes in LiveData. But when player reaches to level 2, recomposition happens as expected from LiveData value.

    Preview

    https://user-images.githubusercontent.com/25173010/163591096-426f03d4-8a2c-4ce5-a6bd-a22cd1a2149e.mp4

    help wanted 
    opened by RajashekarRaju 1
  • Updated readme with all information, added app assets.

    Updated readme with all information, added app assets.

    What's Changed

    Will public the repository soon.

    • Changed app version to starting 0.1.0
    • Added all app screenshots.
    • Updated licenses.
    • Included all categories in readme
      • Roadmap
      • Banner
      • App screens overview
      • Contributions
      • Credits
    documentation 
    opened by RajashekarRaju 0
  • Fixed game screen guesses not updated issue. Improved UX, made changes to so many elements.

    Fixed game screen guesses not updated issue. Improved UX, made changes to so many elements.

    What's Changed

    Navigation

    Issue #13, moving the ViewModel instance creation to top navigation has fixed the issue.

    Light/Dark Theme and Background

    • Added Teal/Red theme color palette for all screens.
    • With ColorFilter modifier, images color changes dynamically.
    • Replaced existing background image with newly created transparent image to match for both teal/red theme background colors.

    | Teal - Light theme | Red - Dark theme | | :--: | :---: | | | |

    Game Screen

    • Player guesses are now updating as expected.
    • When player choses any alphabet, disabled letters will be spark animating infinitely. This is not effective but will change in future.
    • Overall game score wasn't updating as expected, now it's fixed by adding delay so that database can have time to save those values.

    OnBoarding Screen

    • Added rotate animation to button icons to bring game theme effect, not so effective, will change in future.
    • Made corrections to game instructions dialog to show correct game chosen category mode and difficulty.
    • Made changes to default ripple effect in category selectable dialog radio buttons.

    History Screen

    • Made changes to background image opacity to improve history items visibility.
    • Added elevation to history items.
    documentation enhancement 
    opened by RajashekarRaju 0
  • Made changes to game modes.

    Made changes to game modes.

    OnBoarding Screen

    • Added new game mode for players to select. Player can choose to guess between three different categories countries, languages, companies.
    • Added preferences for saving the player chosen mode to load the same settings for next game.
    • Added a dialog for players to mange game settings.

    Game Screen

    • Need to fix game screen state. Elements won't update and change the current player guesses state as expected.
    • Replaced States with LiveData.
    • Made changes to instructions dialog to show all game modes.

    History Screen

    • Added new elements to rows.
    • Shows game category mode. Highlights number of levels reached with progress.

    • Removed entity, dao for words since words data won't be added to room Made changes to database instance creation. Created separate file for all words data.
    • Updated navigation, koin depedencies.
    • Removed unused modules from koin.
    • Made changes to resources, code refactoring.
    enhancement 
    opened by RajashekarRaju 0
  • Applied Koin, Replaced LiveData with States, code cleanup.

    Applied Koin, Replaced LiveData with States, code cleanup.

    What's Changed :

    • Applied Koin for whole project. Removed all ViewModel factories, application and repository instances from navigation.
    • Break down many large composable functions into smaller in all screens.
    • Moved all data related to words, alphabets to separate file.
    • Added comments to all files. Code refactoring, naming conventions, code cleanup.

    History & Game Screen :

    • Replaced States in ViewModels with LiveData in both history/onboarding screen.
    • Made changes to database queries.
    documentation 
    opened by RajashekarRaju 0
  • Completed all screens UI design. Handled states, updated all dialogs.

    Completed all screens UI design. Handled states, updated all dialogs.

    What's changes

    • Made content scrollable in all screens for smaller screen devices.
    • Removed accompanist system ui controller. Made use of window compat insets to add full screen support while playing game.
    • Broke up the bigger composable functions content into smaller composables.

    Dialogs

    • Game instructions dialog completed. This can be accessed while player is playing the game also in onBoarding screen.
    • Game lost dialog, completely designed to show which word player lost guessing, added image foreground slide animation with delay.
    • Game won dialog, shows how many total points scored combining all levels.

    Game Screen

    • Removed many text elements kept with minimum elements to work better in small screen devices.
    • Made changes to alphabets list sliding with animation.

    History Screen

    • Finalized screen design changes.
    • Players can now delete all history data and single game history by sliding.

    OnBoarding Screen

    • Highest score will be shown from history list database.
    enhancement 
    opened by RajashekarRaju 0
  • Sound effects added for player actions, finalized screen designs.

    Sound effects added for player actions, finalized screen designs.

    Sound enabled for player actions with MediaPlayer in all screens.

    Plays sound when

    • Player wins the current level.
    • Player wins game by completing all levels.
    • Player loses the game.
    • Game launches, a background music will be playing which control is given for player to enable/disable.
    • When player taps the alphabet to guess the country word. Same for correct/incorrect guesses for now.

    Changes

    • App launches in immersive mode. Previously this was disabled in history/onboarding screens. Now every screen occupies full screen space.
    • Added game instruction dialog for players to read information, this dialog can be accessed while playing the game. Need to update more clear information to the dialog.

    OnBoarding Screen

    • Finalized OnBoarding screen design changes with background image and foreground icons.
    • Shows highest score from game history.
    • Added more buttons for easing up navigation.
    • Now players can adjust game difficulty from dialog by clicking button. Previously whole content was laid on top of screen, now these are moved inside dialog.

    Game Screen

    • Made corrections to ViewModel values not showing correct points scored by the player from database.
    • Created many reusable composables.
    enhancement 
    opened by RajashekarRaju 0
  • Completed game screen design. Handled recompositions changes.

    Completed game screen design. Handled recompositions changes.

    Game Screen

    • Overall score from all levels, current score in level, total number of levels progress updates correctly. This wasn't the case compared to last PR changes. Because of few recomposition changes few states were not updated as expected.
    • Added circular progress animation for tracking number of attempts left to guess and number of levels completed.
    • Made changes to typography.
    enhancement 
    opened by RajashekarRaju 0
  • Completed main given tasks, making feature implementations.

    Completed main given tasks, making feature implementations.

    At this point the game history is saving perfectly. When player wins by game by completing 5 levels will be summarized as game won else lost.

    Accompanist for controlling system UI.

    • For adding game effect for better user experience, have enabled full immersive mode with accompanist in Game/OnBoarding screens.
    • Added StatusBar, NavigationBar paddings required screens.

    What's Changed

    • Updated to new compose 1.2.0-alpha07, upgraded to latest gradle build tools. No issues found.
    • Handled player win/lose state in game screen showing summary dialog.
    • Handled recomposition changes which player playing the game.
    • Increased attempts from 6 to 8, since it is hard guessing country words.
    • Players can directly see level 2 word after completing the current level.
    • Created and added custom background image to match game theme in 2 screens.

    Issues Need Working

    • For bigger country guessing words if string length > 8 doesn't fit the screen in small width devices.
    • In OnBoarding screen slider for changing game difficulty won't update from player saved game difficulty shared preferences.
    • Create a progressive animation in game screen while user playing to clearly highlight the attempts left, difficulty screen, current game score and highest score from last games.
    • Need to add sound effects for correct/wrong guesses.
    • Update docs.
    enhancement 
    opened by RajashekarRaju 0
  • Reworked game screen and history screen.

    Reworked game screen and history screen.

    History Screen

    • Removed fake entries from history screen, now actual game data will be shown when player plays the game.
    • New column entries in room for HistoryDao to record and show the time and date for each game played.
    • Handled empty history state, show a simple message when no history is available. Needs design rework.
    • A simple swipe to delete functionality for any game history to delete.
    • Created separate DateAndTime utilities file for getting time/date information.

    Game Screen

    • Previously in game screen, random words where repetitive. To prevent this, load initially only 5 unique random words from any player chosen game difficulty. For each word starting from first position match it with current level of game. For first game level get word in first position.
    • Now player guessing words loads as expected into their fields.
    • Once first level as been correctly guessed, the current history of the game will be added to game history. This will be prevented once the player levels work, right now player cannot play second level after guessing word correctly in first level.
    • Added slide animation for guessing alphabets elements (requires rework).
    • At this point, player score, game difficulty, level is being correctly updated with states.
    enhancement 
    opened by RajashekarRaju 0
  • Made design changes,  added new features.

    Made design changes, added new features.

    OnBoarding Screen

    • Added slider for player to change game difficulty between easy(default), medium, hard.
    • Added it's own ViewModel, to update the players game difficulty preferences, show the highest score & level.
    • When user taps exit button, preferences for game difficulty will be cleared.

    History Screen

    • Completed designed history screen, added temporary fake game history details to database. Have few more design changes to make before finalizing this screen.
    • Once game screen is stable and able to save the game data, history screen will show real game data.
    • Made changes to typography, have to add new typography which isn't creepy.

    Game Screen

    • Added modal bottom sheet to prevent user from navigating away from current game. Once user taps back in the middle of the game.
    • Now game screen shows guessing words based on player selected game difficulty in onboarding screen, if not selected latest value from preferences will be loaded.
    • Added few more text elements temporarily to keep track of game changes while playing.
    • Need to redesign the whole screen once everything's stable.

    • Added preferences dependencies.
    • Added fake game data, fake game history entries.
    • Added new column in history table for showing current game level.
    • Made use of enums to keep track of game difficulty chosen by the player.
    • Completed few tasks added to issue #2
    enhancement 
    opened by RajashekarRaju 0
  • Low end small screen devices issue.

    Low end small screen devices issue.

    Issues

    • Immersive mode not working as expected, since app isn't launching full immersive.
    • Made all screen scrollable if elements collapse or hide behind content.
    • Game/Onboarding screen content doesn't load properly for low end devices.

    Pixel 3a

    Sony

    documentation wontfix 
    opened by RajashekarRaju 0
  • Features & tasks

    Features & tasks

    Keeping track of tasks.

    • [x] In OnBoarding screen Add options for player to choose between three different difficulty levels easy, medium, hard.
    • [x] Instead of random words, add country name guessing category. Based on length of country name decide the difficulty level.
    • [x] In history screen, highlight those items which are won.
    • [x] For each game history, save the date/time and level/difficulty for the History entity.
    • [x] While alphabets reset before/after new word pops, create bubble/bounce effect animation for each alphabet.
    • [x] Make a record of highest scoring game to show in game/onboarding screens.
    • [x] Create a image or draw on canvas, this should be drawn behind history/onboarding screen just to create death game effect.
    • [x] For all existing elements, make use of animated visibility and draw accordingly to capture players focus.
    • [ ] Optional - Add curtain reveal effect transition with hangman when game starts/exit.
    • [ ] Optional - Make changes to border/shapes matching the creepy font effect.
    • [ ] Optional - Create field for collecting player name once the game ends to show up in history.
    • [ ] Optional - Create rain effect of falling skull shapes in onboarding screen continuously.

    Main tasks

    As a user, when I'm in a game session,

    • [x] I want to see my score history.
    • [x] I want to be challenged with unique words only.
    • [x] I want to know how many unique words I can still guess.

    As a user, when I'm playing the match,

    • [x] I want to know how many chances I still have.
    • [x] I want to be able to try out letters in any order I want.
    • [x] I want to know how many points I made when I completed a word.
    • [x] I want that my game state is persisted.
    documentation 
    opened by RajashekarRaju 0
Releases(v0.1.0)
  • v0.1.0(Apr 18, 2022)

    :video_game: Hangman - Built With Compose :paintbrush:

    :sparkler: What's New: v0.1.0

    • [x] Players will be challenged with unique words only.
    • [x] Players can view their score/game history.
    • [x] Players should know how many unique words can still guess.
    • [x] Players can see how many attempts they have to guess the word.
    • [x] Players can try out letters in any order they want.
    • [x] Players can to know how many points made when I completed a word.
    • [x] Players can to know how many points scored by completing all levels.
    • [x] Persist the game state at any point of the game.
    Source code(tar.gz)
    Source code(zip)
    release-v0.1.0.apk(6.16 MB)
Owner
Raj
I'm not sure about Mars, but I'm definitely down to Earth.
Raj
Our maze game is an 2d-animation game developed using android studio.

Our maze game is an 2d-animation game developed using android studio. The game consists of a ball and a board with a hole in the center of it. We are using accelerometer as controller to guide ball towards the hole. T

Suraj Devgan 6 Nov 29, 2022
Game made with Korge (Kotlin Multiplatform game engine)

MolesAttack Kotlin Multiplatform Game Play Html/js: https://feliperce.github.io/MolesAttack-Distribution/ Jar: https://feliperce.github.io/MolesAttack

Felipe Rodrigues 10 May 30, 2022
Fifteen is a puzzle game created using Jetpack Compose for Android.

Fifteen / Jetpack Compose Fifteen is a puzzle game created using Jetpack Compose for Android. The goal of the game is to arrange the knuckles in ascen

Timur 2 Jan 17, 2022
Android 2048 Game in jetpack compose

Android 2048 Game in jetpack compose A simple 2048 game written with 100% Jetpack Compose. Features Jetpack Compose Material 3 MVVM Adaptable theme Da

João Manaia 10 Oct 1, 2022
🎮 A Minesweeper like puzzle game, built using Jetpack Compose, for Android.

Minesweeper w/ Jetpack Compose This is a Minesweeper-like puzzle game, built using Jetpack Compose, for Android. The objective of this game is to clea

Jaya Surya Thotapalli 64 Jan 2, 2023
A simple Snake game implemented using Compose for Desktop

A simple Snake game implemented using Compose for Desktop

Arkadii Ivanov 58 Dec 27, 2022
🎮 A basic game template for Compose for Desktop

compose-desktop-game-template Game Template - Compose for Desktop ✨ Demo ✍️ Author ?? theapache64 Twitter: @theapache64 Email: [email protected] F

theapache64 5 Aug 13, 2022
Chrome's Dino T-Rex game developed in Jetpack Compose

Chrome's Dino T-Rex game developed in Jetpack Compose

Wajahat Karim 230 Dec 29, 2022
A GoBang game built with Compose Multiplatform

cmp-gobang English | 中文介绍 A GoBang game built with Compose Multiplatform How to run config Host address add the IP of desktop into <server_host/> of s

fundroid 32 Dec 24, 2022
Flappy Bird game built with Jetpack Compose & Jetpack Splash Screen

Flappy Bird by Compose ?? Description Flappy Bird game built with Jetpack Compose & Jetpack Splash Screen. ?? Motivation and Context All UI built with

石文斌 2 Oct 28, 2022
Wordle game clone written in Kotlin & using Compose UI Toolkit.

Wordle Compose Wordle game clone written in Kotlin & using Compose UI Toolkit. Screenshots Compose for Desktop Main screens Playing Victory End of gam

Olivier Patry 37 Nov 3, 2022
🛥 Stream Draw - a real-time multiplayer drawing & chat game app built entirely with Jetpack Compose

?? Stream Draw is a real-time multiplayer drawing & chat game app built entirely with Jetpack Compose. Draw and guess words with your friends! This pr

Stream 286 Dec 20, 2022
An easy open source Android Native Game FrameWork.

JustWeEngine - Android Game FrameWork An easy open source Android Native Game FrameWork. Engine Flow Chart How To Use? Import Engine's module as Libra

JustWe 767 Dec 8, 2022
Desktop/Android/HTML5/iOS Java game development framework

Cross-platform Game Development Framework libGDX is a cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux

libgdx 20.9k Jan 8, 2023
Free Android 2D OpenGL Game Engine

AndEngine Donations While developing AndEngine was a lot of fun, it also also consumed many(!) months of my life. It actually continues to cost me a s

Nicolas Gramlich 3.2k Jan 5, 2023
A cross-platform Java game Engine (Framework) , support JavaFX / Android / IOS / HTML5 / Linux / MAC / Windows

Loon Game Engine (Java Game Framework) EN / KR Free Game Resources Links Download Loon Game Engine Only Android-studio Template : androidstudio-templa

cping 502 Jan 4, 2023
Android Kotlin: Matching Kitties: A Game Inspired by Cats

Android Kotlin: Matching Kitties: A Game Inspired by Cats A kotlin based Android memory game Screenshots | | | | | | | | | Viewing the App You can clo

Ryan Jandrick B. Obeles 20 Aug 1, 2022
a bitcoin key collision game for android

BitteryApp BitteryApp is an opensource bitcoin key collision game for Android. How to Build BitteryApp source code build in chromium building environm

null 3 Jul 12, 2021
SMBClone - SMD clone custom game engine. (Desktop + Android)

SMBClone Simple crossplatform game engine for like SMB game! Supported platforms

Victor Varenik 4 Jul 4, 2022