Submissions from 2015-09-23 to 2015-09-24 (1 total)

A submission for Make games. 242

Progress on the new FRP stuff. Things are now organized into components that bind and unbind observable subscriptions to love2d events when they are created or destroyed. Additionally, each component has a 'state' variable which is an observable representing all of its state that changes over time and a 'props' variable which is just static data that doesn't change (somewhat inspired by the ReactJS framework). This is cool for a few reasons:

  • It lets us do functional programming on love events, which makes processing keyboard and mouse input really nice.
  • It lets us do some neat stuff related to object states. For example, a pattern we frequently use to render objects is to interpolate between its position in the previous frame and its current position to get a smooth transition. Normally we could set up two variables, one for the current position and another for the previous position, set the previous to equal the current at the beginning of the frame, and perform our updates. Using our new system we can express this more elegantly by just saying `object.state:pluck('position'):window(2)`, which will give us the position at the previous frame and the next frame without having to deal with any extra variables.
  • It also lets us better reason about values that change and values that do not change. This may come in handy later on, we'll see.