Giter VIP home page Giter VIP logo

Comments (2)

inakianduaga avatar inakianduaga commented on July 20, 2024

Game frame "engine"

An interval observable with say 30fps, so

const framesGenerator = Observable.interval(1000/30) 

Ray:

For each ray, we need to have:

  • Velocity: Upon creation, maps the framesGenerator to a set of velocities over time (can be constant of changing if we use gravity)
  • Position: Integrates the velocity observable, so each point will be an operation over the velocity observable. Ideally takes a starting position which would be linked to the cannon position (right now it's always (0,0)
  • RayCollision: Another observable that will take the Position observable and check against all the other rays (we probably need to use zip to create a list of all positions and then check if the pair we want collides with any of the other pairs
    • Should emit the pair of elements that collided so we could create another ray from it if we wanted
  • DrawableRay: This will be derived from the position until a ray collision occurrs. This is what we listen to to draw the state.

Rays:

  • Each new ray position is pushed in an array of rays, which we need to use to detect collisions.

from reactive-sandbox.

inakianduaga avatar inakianduaga commented on July 20, 2024

Ray Colleciton Observable

  1. Using ofArrayChanges observable we can create an observable that will emit whatever ray is pushed to the array.
  2. Using a derived scan observable we can always have another observable that holds all current rays.
  3. Using a flatmap operation we can get the list of all coordinates/id from these observables, which we will use to detect collisions with each of the rays.

from reactive-sandbox.

Related Issues (3)

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.