Code Monkey home page Code Monkey logo

duckhunt-js's Introduction

DUCK HUNT JS v4.0

Play the game

This is a GitHub fork that extends the MattSurabian 's DuckHunt Implementation.

This fork enables you to use your phone as a machine gun in the game.

Prints

Machine Gun on the Phone

App running on Desktop

About

This is an implementation of DuckHunt in Javascript and HTML5. It uses the PixiJS rendering engine, Green Sock Animations, Howler, and Bluebird Promises.

Rendering

This game supports WebGL and Canvas rendering via the PixiJS rendering engine.

Audio

This game will attempt to use the WebAudioAPI and fallback to HTML5 Audio if necessary. Audio is loaded and controlled via HowlerJS.

Tweening

The animations in this game are a combination of PixiJS MovieClips built from sprite images and tweens. Since PixiJS doesn't provide a tweening API, Green Sock was used.

Game Logic

The flow of this game is managed using Javascript. The main chunks of business logic are implemented as ES6 classes which are transpiled to ES5 using Babel.

Working With This Repo

There are two different services here. game is where the DuckHunt game is running and mobile-controller is the game's machine gun controller.

  • You must have nodejs 18 installed.
  • Clone the repo into a directory of your choice

Mobile Controller

  • cd into mobile-controller directory and run npm ci --silent
  • You'll need a SSL certificate to be able to retrive gesture data from mobile devices in browsers such as Chrome. I put a script that performs an action to generate a localhost cert for you. It uses the mkcert so make sure you install it.
  • After generating the certificate on the credentials folder, run npm run dev and your API will be ready to be used on port 3000

Make sure to save your IP (eg. 192.168.68.107). On mac run ifconfig | grep 192 It'll show you the IP endpoint you'll need to communicate both projects

Game

  • cd into game directory and run npm ci --silent
  • change the main.js file adding your local IP that you stored from the previous step.
  • Use npm start to start a local webserver which will make the site available at http://localhost:8080/.

Working With Audio and Visual Assets

This repo ships with committed dist files to make it easy for developers to get up and running. If you really want to get into some leet haxing and change the way this game looks and sounds then you'll need to work with audio and image sprites. The following tasks make that possible:

  • To rebuild audio assets use npm run audio (there is a hard dependency on ffmpeg to run this task)
  • To rebuild image assets use npm run images (there is a hard dependency on texturepacker to run this task)

Bugs

Please report bugs as issues.

Contributing

Pull requests are welcome! Please ensure code style and quality compliance with npm run lint and include any built files.

Credits

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.