Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(-1)

These elastic balls aren't that difficult to program. I do this all the time. After playing World of Goo, I reprogrammed the core gameplay in at least 5 languages/engines.

Basically you just need to do this for every connection:

fn apply_connection_force(ball1: &mut Ball, ball2: &mut Ball, goal_distance: f32, force_factor: f32) {
    let diff = ball2.pos - ball1.pos;
    let dis = diff.magnitude();
    let dir = diff / dis;
    let force = dir * (dis - goal_distance) * force_factor;
    ball1.vel += force;
    ball2.vel -= force;
}