ppb / pursuedpybear

A python game engine.
https://ppb.dev/
Artistic License 2.0
258 stars 98 forks source link

Higher order timing functions and classes #411

Open pathunstrom opened 4 years ago

pathunstrom commented 4 years ago

We should provide tools to handle the various timing related tasks. We have some fixed patterns throughout the code base, but it'd be nice to handle those a step up.

AstraLuma commented 4 years ago

Some ideas for "common" (idk how common they are) time-related functionality:

AstraLuma commented 4 years ago

My quick prototype:

@call_repeatedly(seconds=0.5)
def beat(self, event, signal):
    stuff

def on_update(self, event, signal):
    self.beat(event, signal)
pathunstrom commented 4 years ago

Is pathing similar to easing? Or do you intend for it to interact with a navigation mesh?

AstraLuma commented 4 years ago

Like, it would potentially have an easing aspect?

Honestly, pathing is an entire rabbit hole of options, but it's the basic concept of "moving a sprite along a predetermined path", which sounds tricky.

It was inspired by @ironfroggy's seed magic screenshot, where there's a sparkle sprite that follow a non-trivial path from the play space to the avatar. https://i.imgur.com/gON4Ejg.gif

ironfroggy commented 4 years ago

@astronouth7303 Those sparkles are moving with a bezier-path utility I implemented in the engine. That and the lerp utilities it's built on would be useful in addition to the timing utilities in ppb, but based on my experience building them I definitely would consider them separate from timing-related utilities.