GithubHelp home page GithubHelp logo

eiriklv / fluxpybird Goto Github PK

View Code? Open in Web Editor NEW

This project forked from expo/fluxpybird

0.0 2.0 0.0 315 KB

some ideas involving games and Redux

Emacs Lisp 1.49% JavaScript 96.43% Python 2.09%

fluxpybird's Introduction

Fun!"/

This is a game written with exponent, react-native and redux.

Here are a few quick notes. I'll write a longer blog post soon explaining in more detail!

  1. Redux actions are used for all game events. For example, the { type: 'TOUCH', pressed: <whether pressed> } event, when dispatched, causes the game's reducers to respond to a touch press. You see in the above GIF image a queueDispatch(...) call which queues an action for dispatch on next 'TICK' (which is itself an action { type: TICK, dt: <time since last frame } which advances game time by dt). 'Touch' dispatches the 'TOUCH' actions, Clock the 'TICK' ones.
  2. There is a babelified remote-REPL interface. Works on simulator as shown in the GIF image above, works on device too. The REPL has access into the context of a module, and can modify private variables or update functions in there. So, hot-reloading (gotta clean up some details)! It shouldn't be too hard to make an emacs or atom interface that's similar to SLIME for Lisp. Since it uses babel and also seems to catch the project-specific .babelrc, you can use fun ES6 things.
  3. The game has time travel. Redux makes this easy. After you lose, if the plane is still on screen, a touch makes the game start going backwards in time (a quick peek of that in the GIF image above). Sort of like Braid.
  4. I tried to be super modern and used stateless function components and nice destructuring etc. everywhere.
  5. You can queue dispatches from within reducers. Reducers get their usual state, actions parameter but also a dispatch parameter which queues actions to be performed after the current action is fully reduced. Used here for example to queue an ADD_PIPES action (handler visible a few lines of code below) when the distance to the next pair of pipes is < 0.

Art Sources

fluxpybird's People

Contributors

nikki93 avatar

Watchers

 avatar  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.