Log In  
Follow
thykka
Follow
PePu invite 19/2021
by thykka
BoozeSnek
by thykka

Newtonian gravity simulation

It's a bit unstable. Vector math and fixed point numbers don't mix too well, although I'm sure this could be modified to better utilize the available digit range..

Press Z to pause and adjust the velocities.
Press Ctrl+R to reset the simulation.

Cart #newtgrav-0 | 2021-06-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

P#93346 2021-06-11 09:12 ( Edited 2021-06-11 09:14)

It does this.

Cart #sirpinski2-0 | 2021-06-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Move the mouse to restart

Old version:

Cart #sirpinski-0 | 2021-06-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#93317 2021-06-10 19:57 ( Edited 2021-06-10 20:41)

Cart #bons8-0 | 2021-05-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#92823 2021-05-30 22:53

Cart #pepu_invite_19_2021-0 | 2021-05-18 | Code ▽ | Embed ▽ | No License
5

P#92129 2021-05-18 13:26

I'm working on this small animation library. It adds a straightforward way to animate an object's state.

Usage example:

Let's say there's a game object called "progress", representing a progress bar we want to animate:

progress={value=0}

we could animate the value rising from 0 to 100 by adding this to something that triggers the progress to start:

tween(progress,{value=100})

and in _update() we want to call the animate() function to keep updating the value, until it's duration has elapsed:

if has_animations(progress) then animate(progress) end

Demo

Cart #tweendemo-2 | 2021-02-21 | Code ▽ | Embed ▽ | No License
3

Configuration

There are some global variables you can override:

animate_default_duration=0.4
animate_default_easing=ease_quad_out
animate_key="__a" --which key should contain the tweening animation state

You can also add your own easing functions:

function my_easing(t)
 return t*t*t
end
add(animate_easings,my_easing)
ease_my_easing=#animate_easings

Arguments

tween(node,target,options)
  • node - table that contains the value that should be animated
  • target - table of the values that should be tweened
  • [options.duration] - how long the tween should play
  • [options.easing] - easing function (included easings: linear, quad_in, quad_out and quad_in_out)
  • [options.custom_time] - custom starting time

Tweens are removed automatically once the animation completes. Starting a new animation for a key with an active animation will overwrite the previous one, continuing animating from it's current value.

Download

The most recent version is available at https://github.com/thykka/pico-8-libs/blob/main/animate.lua

Changelog

  • v3
    • refactored & parametrized almost everything
    • animate_key() replaced by tween()
    • can now tween multiple values with one tween() call
P#87978 2021-02-21 18:35 ( Edited 2021-02-22 00:13)

BoozeSnek

Official port of PePuSnek for SCRIPT-8, improved.

WARNING: Contains flashing lights!

Cart #snek8-5 | 2020-11-14 | Code ▽ | Embed ▽ | No License
13

Changelog

  • 14-11-2020
    • Changed scoring rules; points are now accumulated, instead of calculated when the game ends
    • Added persistent HiScores
    • Music on/off setting is now persistent
P#84020 2020-11-14 19:05 ( Edited 2020-11-14 19:52)

Checking out a couple of different methods to fill the screen.

cls seem slightly faster than memset. I wonder if the difference is due to the multiplication op, or if there's something else going on...

Cart #scrnfllbnchmrk-1 | 2020-11-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Left/Right switches modes

P#83719 2020-11-04 23:12 ( Edited 2020-11-04 23:22)

Hello, World!

Cart #cfds_intro_1-0 | 2020-11-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

It's not a lot,
but it's honest glitch.

P#83631 2020-11-02 22:05 ( Edited 2020-11-03 15:30)

Follow Lexaloffle:        
Generated 2021-06-22 05:00:34 | 0.095s | Q:40