GithubHelp home page GithubHelp logo

appcoinsph / js-slots-crajust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danilo012/js-slots-cra

0.0 0.0 0.0 3.84 MB

JS Slot Machine is a Progressive web app with a regular slot machine game that has the logos of main JS-related tools as symbols.

Home Page: https://marianapatcosta.github.io/js-slots-cra/

JavaScript 20.01% TypeScript 63.30% HTML 0.43% SCSS 16.26%

js-slots-crajust's Introduction

JS Slot Machine

JS Slot Machine is a Progressive web app with a regular slot machine game that has the logos of main JS-related tools as symbols. Deployed at https://marianapatcosta.github.io/js-slots-cra. Group 732

Implemented Functionalities

Game features

  • Slot Machine with 5 reels (with > 30 symbols) and 3 rows, with 9 Pay lines.

  • Follows the general rules of slot games, i.e, it aims to make the symbols spin and then check if you have combinations of 3 or more equal symbols displayed at one of the 9 possible winning lines;

  • Different win factor according to symbol frequency and number of symbol matches (from 3 to 5);

  • Customizable bet amount;

  • AutoSpin capability;

  • Free spinnings;

  • Bonus WildCards;

  • Big winning due to win amount multipliers;

  • Special Symbols;

  • image

  • Sounds on button click, winning, loss and spinning;

  • Lights blinking on winning and animation on matching symbols (including when Bonus wildcards are won);

General features

  • Offline capability;
  • Instalable in your device;
  • Responsive design;
  • Dark theme;
  • Background theme;
  • Multilanguage (English and Portuguese);
  • Share game url;

Lighthouse report for Desktop

  • image

Technical Stack

  • TypeScript;
  • React (use of functional components and hooks, portal, context, custom hooks);
  • Redux (including persistence middleware to store state at localStorage);
  • Webpack /CRA;
  • SCSS modules with BEM methodology;
  • typed-scss-modules (to generate TypeScript definitions for SCSS modules);
  • HTML Canvas (for drawing Pay Lines);
  • react-i18next for internationalization;
  • CSS animations (for symbol SVGs and fake loader);
  • Jest and React Testing library (for some unit tests with test coverage);
  • react-transition-group (for modal/toast transitions);
  • GreenSock Animation Platform (GSAP) (for spin animation);
  • Basic ESlint and Prettier configs;
  • GitHub actions image
  • Cypress (basic setup only);

What I've used but had to let go

Vite (repo and deploy )

  • Error on running unit tests due to a supposed error with react-i18n and vite-plugin-pwa mocks;
  • Tool to generate type definitions for scss (vite-plugin-sass-dts) caused errors;
  • Problems when registering web workers;

Issues

Spin animation is buggy (after stop spinning, there is a 'jump' to show the win screen)

Attempts:

  • no tool animation;
  • GSAP animation of all symbols, of reel as a whole, both depending on isSpinning redux state;
  • Add the final slot screen symbols at the end of spinning;
  • Prepare the shuffled reels with final slot screen symbols before spinning (but reels do not stay at proper position, showing the wrong symbols for final slot screen);
  • DOM manipulation with ids and determining the visible reels by assessing top css property (ugly code);
  • useImperativeHandle hook to execute reel animation from parent component and overcome the state update issue was not working;

CRA

  • no support for path alias (add craco to overcome this issue);
  • Cypress configuration needs several additional packages and I could not run the first test I wrote because cypress/webpack-preprocessor (needed e.g. to load scss files) is incompatible with React v18.1.

Available Scripts

In the project directory, you can run:

yarn install

Installs all the dependencies required to run and develop this application.

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

yarn build

Build a production-ready application.

yarn lint

Run linter command.

yarn validate-ts

Runs TypeScript validator

yarn gen-scss-types

Runs typed-scss-modules and generates types for scss modules, keeping the namespace using BEM css methodology

yarn test:unit

Launches the unit test runner in the interactive watch mode.

yarn test:unit-coverage

Launches the unit test runner in the interactive watch mode and shows test coverage report.

yarn test:e2e

Launches cypress tests.

yarn deploy

Deploy the build app to GitHub pages.

js-slots-crajust's People

Contributors

danilo012 avatar marianapatcosta avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.