Metaballs

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
unixfreak
Citizen
Posts: 82
Joined: Thu Oct 15, 2015 6:25 am
Location: Bristol, UK
Contact:

Metaballs

Post by unixfreak »

Image

This module creates a drawable surface with some HSL bouncing metaballs.

Maybe someone will find this useful as a starting point for something else. Code can be found here:
https://github.com/Jigoku/love2d_metaballs

Basic Usage:

Code: Select all

function love.load()
	require("metaballs") 
	metaballs.create(8) 	-- spawn 8 metaballs
end

function love.draw()
	love.graphics.draw(metaballs.surface(),0,0)
end

function love.update(dt)
	metaballs.update(dt)
end
This was inspired by a coding challenge video i came across recently: https://www.youtube.com/watch?v=ccYLb7cLB1I
Attachments
metaballs.love
(1.99 KiB) Downloaded 235 times
azoyan
Prole
Posts: 25
Joined: Wed Dec 27, 2017 5:19 pm

Re: Metaballs

Post by azoyan »

Looks great!
User avatar
YoungNeer
Party member
Posts: 118
Joined: Wed May 15, 2019 7:49 am

Re: Metaballs

Post by YoungNeer »

Perhaps I could use this as background in my MainMenuState. Thanks a lot :awesome:
My Github- your contribution is highly appreciated
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Metaballs

Post by grump »

Looks nice! I played around with it for a bit and made some optimizations. The calculation is now done in a shader, and the texture is not recreated every frame. It's quickly hacked in though, so the code is far from optimal and not very pretty. ;)
Attachments
metaballs2.love
(2.02 KiB) Downloaded 239 times
User avatar
unixfreak
Citizen
Posts: 82
Joined: Thu Oct 15, 2015 6:25 am
Location: Bristol, UK
Contact:

Re: Metaballs

Post by unixfreak »

grump wrote: Thu Aug 01, 2019 2:18 pm Looks nice! I played around with it for a bit and made some optimizations. The calculation is now done in a shader, and the texture is not recreated every frame. It's quickly hacked in though, so the code is far from optimal and not very pretty. ;)
Hey, that's cool. Yeah, runs much faster as a shader. I still haven't a clue at writing things via shader language, will have to dig into that more in the future. :awesome:
Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests