logoalt Hacker News

Starfling: A one-tap endless orbital slingshot game in a single HTML file

489 pointsby iceberger2001last Thursday at 1:52 AM122 commentsview on HN

Comments

0x3ftoday at 1:01 PM

I would make restarting much much faster than it is now. That's the most annoying part and it breaks the satisfying chain completely for me. I miss and then have to watch it slowly fall, or struggle to find the reset button. And even if I hit the reset, I have to go through the menu.

At the very least, put the reset and play again buttons in the same spot, so I can just keep tapping/clicking there.

Super Meat Boy is how all games like this should be.

show 2 replies
iceberger2001last Thursday at 1:52 AM

Hey HN, I built STARFLING, a simple hyper-casual space game you can play right in your browser.

You orbit a star with a ball. Tap anywhere to release and sling it through space. Catch the next star to lock in orbit and keep going. Miss and it's game over.

The whole thing is just one HTML file with vanilla JS, Canvas, and Web Audio. No frameworks, no build step. Loads in under 2 seconds on phone or desktop.

There's a combo system if you release quick, a skip bonus for jumping over stars, and it gets harder the longer you last. When you die you get a cool trail art picture of your whole run that you can share.

Audio is all generated on the fly and it has haptics too. Pretty satisfying once you get the timing down.

Play it here: https://playstarfling.com?utm_source=hn&utm_medium=showhn

Would love your thoughts on the feel, difficulty, and whether the trail art is fun or not.

Thanks!

show 9 replies
onion2ktoday at 4:19 PM

I gave Codex 5.4 Playwright MCP access to the site and a prompt of "Use Playwright CLI Skill to open https://playstarfling.com/ and load the game. Work out how to play it, and devise a strategy to win." After a about half a dozen attempts it had figured the game out. Then I prompted it to "Score as much as you can." It wrote itself an auto-play script that just keeps going.

I stopped it running at 10866. That's currently the high score. I appreciate that this is pointless and proves nothing, but I've been experimenting with automating testing games (I work at a gaming company at the moment) so it felt like an opportunity to try an experiment.

show 1 reply
cpcallentoday at 8:35 AM

I am completely confused about the orbital mechanics in this game. They seem completely broken; at any rate they do not work remotely like any other simulation I've played with (e.g. Gravitation or Kerbal Space Program). The bodies other than the first body appear to actively deflect the spacecraft away!

show 3 replies
mutitoday at 5:15 AM

Fun. Not sure if this applies on desktop, but on mobile the quick/fast/blazing/skip text often blocks vision of the ball making it harder than it should be to make combos

show 3 replies
Twirrimtoday at 6:02 AM

Fun, but dark grey text on a dark background? Bit hard to read a bunch of the text.

It also seems like there's gravity coming from off screen assets (or maybe it's the bottom of the screen?) causing the projectile to curve in unexpected ways, and not be captured as strongly by the gravity of the visible objects as I'd expect.

yuppiepuppietoday at 6:36 AM

This is good fun! I’ve added it to the HN Arcade :) https://hnarcade.com/games/games/starfling

ericskifftoday at 4:54 AM

Fun, but the way they fly doesn't quite match my intuition. Why would an object curve when I send it out on the tangent? Wouldn't that be a straight line unless it's affected by a different gravity well?

show 2 replies
imglorptoday at 7:37 PM

I love it.

But why make apps for it? The web page is perfect as is

OneMorePersontoday at 2:49 PM

I like it! One complaint is that if you are going fast it starts to display a "Quick!" (or something like that) message on top of the middle of the screen. This makes me want to continue going quickly, but the message is blocking me from properly seeing the orbit, so I end up trying to keep the streak going and most often launch and miss cause I can't see. Maybe display it off to the side in empty space?

rkagerertoday at 9:27 AM

Neat, and nice audio, but I wish it were a little more forgiving. Eg. Combos or surviving several jumps might collect "lives" that recover your last orbit if you screw up.

Might also be fun if you encountered powerups as you explore deeper into the map (eg. gravity attraction, project path, etc), or even got to pick between forks in the route. The trail art reminds me of Out There.

haarlemisttoday at 9:02 AM

Looks and plays quite nicely. I don't know how well it represents the real slingshot physics, but it's quite fun.

I've made a similar little web game based on Lunar Lander, check it out!

https://landed.theelderscripts.com/

Kim_Bruningtoday at 6:44 PM

Hmm, you can't fall back to a previous orbit. Those don't detect your presence

NooneAtAll3today at 6:13 AM

I don't see the "orbital" part. Ship flies in straight lines

Doesn't seem that hard, just a boredom endurance

florbotoday at 4:41 PM

Game is fun, sure the mechanics aren't like real transfers but this appears to be a quick reflex challenge, not a lesson in astrophysics. The only gripe I have is all the flashes and distractions if I go to fast. I don't want ANY extra visuals when I'm concentrating on rapid shots.

show 1 reply
bhollantoday at 2:55 PM

I've been looking for a game from the "flash era" that's incredibly similar to this one! It was "fling-this-wad-of-duct-tape-to-clog-the-black-hole" as a metaphor, but I forget the name. It had similar "orbit" dynamics, but the entire game was setting the initial angle/velocity and then the orbits just 'did their thing' from there. This looks really cool! I'm already up to 11 as my best!

If you like this, you will for sure love the game "12 Orbits"!

foresterretoday at 6:22 AM

Fun :)

Small idea for improvement: the "fast" text is often over the same space as the ball, which makes it harder to see where the ball would be going.

client4today at 1:19 PM

If I miss but land back in the old gravitational field, I'd like a retry

show 1 reply
b3orntoday at 8:25 AM

Reminds me a little of an old game called Slingshot[0], I think it implemented the idea much better as you actually had to slingshot and consider gravity. Someone should turn it into a browser game, would be much more fun than this.

[0] https://sourceforge.net/projects/slingshot-game/

show 2 replies
peatoday at 5:14 PM

Good fun! Spacebar should launch, r should reset, maybe I'm imagining it, but it's a lot slower and thus easier on my phone than my MBP.

systemsweirdtoday at 7:02 AM

Seriously fun! A first it felt frustrating but it was interesting that at a certain point (after about 10 minutes) I suddenly got an intuitive feel for the ball’s trajectory and it became addictive at that point.

My only gripe is you render the bonus notification too near the ball and it distracts me and makes it harder to keep a combo going.

RobotToastertoday at 8:11 AM

>single html file

Looks at imports

>Google Tag Manager

-_-

show 1 reply
nrawetoday at 3:23 PM

This is an excellent and distinctly frustrating game Echo comments on restart being faster; maybe having the % stats in the main ui somewhere. Will be recommending this to some friends.

Uncorrelatedtoday at 5:51 AM

I got 54, allegedly better than 99% of players. But I also note that a score of zero is apparently better than 32% of players.

Very fun.

show 2 replies
vunderbalast Thursday at 2:25 AM

Nice job. Consider allowing the use of a key (Z, spacebar, etc) in addition to the mouse.

Related but I played a similar orbital minigame a while back on Itch.io which has a bit of a 2D Mario Galaxy feel to it as well.

https://danceswithpixels.itch.io/orbital-slingshot

hamandcheesetoday at 6:33 AM

Scoring 0, 1, 2, 3, or 4 all say better than 32% of players. Something isn't right.

show 1 reply
noisy_boytoday at 4:50 PM

Spacebar should launch. I should be able to use arrow keys to speed it up.

oh_fiddlestickstoday at 12:59 PM

Its a nice start, but there is a certain irritation in that the popup text is directly over the puck. I felt like I was losing more because I couldn't see the puck under the combo counter than anything in the game.

hirako2000today at 10:29 AM

I don't get the gameplay.

Ok on touch gravity of the orbiting takes off. And if I don't land the next I start again and get prompted for my email each time.

It reminds me of certain games on NES which could be played for hours, once you lose your 3rd life you start all the way from the beginning.

Here it's the same. With one life.

abcde666777today at 2:57 PM

Fun game, though a difficulty of playing it on a phone is your primed finger gets in the way of seeing the ball!

ewatchtoday at 7:44 AM

Really nice and very fast becoming addicted :D. Feedback from my side:

- on desktop (tested in Brave Browser) the speed is faster than on mobile (is this supposed to be ?)

- on desktop would be nice to have a short cut to instantly start a new game (may be on mobile you could calculate early on if the balls curve would have a collision and show a button to directly restart)

throwthrowuknowtoday at 11:46 AM

The text that pops up in the middle obscures the current position making it hard to immediately launch again. Maybe it should be closer to the bottom of the screen?

modinfotoday at 8:19 AM

Cool game! I scored 7581 (120 stars) on STARFLING :P

https://pod.sekor.eu.org/@modinfo/statuses/01KNXT3ZQDTHZBDYF...

show 2 replies
AFF87today at 5:51 PM

Maybe having some saves?

fathermarztoday at 9:11 AM

I love this and it’s very clean. Only piece of feedback, put the play again button where the scores are as that is where the thumb sits on the phone to do the tapping. Mind numbingly groovy

niklasdtoday at 1:18 PM

Very fun! If you play it on a big monitor, the games slows down for some reason.

rikschenninktoday at 5:31 AM

Nice, enjoyable.

I did however expect the stars to attract my ship, that combined with the top down gravity vector made it less intuitive.

It also makes it feel like a game happening in earths atmosphere instead of space, it impacts the possible sense of scale.

Still fun :)

gverrillatoday at 6:25 PM

I don't like the game. The sounds. The way movement flows. Also the game loop is slow after I lose or realize I'll lose.

fifiluratoday at 8:40 AM

Took a little bit of figuring out why I always exploded. The restart button was right where I tapped to launch.

I loved the simplicity, it was fun!

deviationtoday at 6:14 PM

Paste this bad-boy into your console and watch the real expert play:

(function () { "use strict";

  // ── CONFIG ──────────────────────────────────────────────────
  const AUTO_RESTART = true;
  const RESTART_DELAY = 800;   // ms before auto-restart after death
  const MUTE_SOUND = true;     // silence during autoplay
  const SIM_FRAMES = 350;      // max frames to simulate per check
  // ────────────────────────────────────────────────────────────

  let running = true;
  let totalGames = 0;
  let botBest = 0;
  let scores = [];

  if (MUTE_SOUND && typeof snd !== "undefined") snd = false;

  function wouldHitTarget() {
    if (st !== 1 || !bl || !bl.orb) return false;

    var targets = [];
    for (var i = cWI + 1; i < Math.min(wl.length, cWI + 3); i++) {
      if (wl[i] && !wl[i].caught) targets.push(wl[i]);
    }
    if (targets.length === 0) return false;

    var ta = bl.angle + bl.dir * Math.PI / 2;
    var nw = wl[cWI + 1];
    var spd;
    if (nw) {
      var ddx = nw.x - bl.x, ddy = nw.y - bl.y;
      spd = Math.max(4.5, Math.min(7.5, Math.sqrt(ddx * ddx + ddy * ddy) * 0.038));
    } else {
      spd = 5.5;
    }

    var x = bl.x, y = bl.y;
    var vx = Math.cos(ta) * spd;
    var vy = Math.sin(ta) * spd;

    for (var f = 0; f < SIM_FRAMES; f++) {
      vy += 0.06;
      vx *= 0.995;
      vy *= 0.995;
      x += vx;
      y += vy;

      for (var t = 0; t < targets.length; t++) {
        var dx = x - targets[t].x, dy = y - targets[t].y;
        if (Math.sqrt(dx * dx + dy * dy) < targets[t].radius + 20) {
          return true;
        }
      }

      if (y > 2500 || x < -400 || x > W + 400) return false;
    }
    return false;
  }

  function autoRestart() {
    if (st !== 2) return;
    var go = document.getElementById("game-over");
    var rp = document.getElementById("revive-popup");
    if (go) go.classList.add("hidden");
    if (rp) rp.classList.add("hidden");
    document.getElementById("pause-btn").style.display = "flex";
    document.getElementById("sound-btn").style.display = "flex";
    st = 1;
    init();
  }

  function tick() {
    if (!running) return;

    if (st === 0) {
      handleTap();
    } else if (st === 2 && AUTO_RESTART) {
      totalGames++;
      scores.push(sc);
      if (sc > botBest) botBest = sc;
      console.log(
        "Game #" + totalGames +
        " | Score: " + sc +
        " | Jumps: " + jmp +
        " | Combo peak: " + cc +
        " | Bot best: " + botBest
      );
      setTimeout(autoRestart, RESTART_DELAY);
      setTimeout(function () { requestAnimationFrame(tick); }, RESTART_DELAY + 50);
      return;
    } else if (st === 1 && bl && bl.orb) {
      if (wouldHitTarget()) {
        release();
      }
    }

    requestAnimationFrame(tick);
  }

  window.stopBot = function () {
    running = false;
    console.log("Bot paused. Call startBot() to resume.");
  };

  window.startBot = function () {
    if (running) return;
    running = true;
    console.log("Bot resumed.");
    requestAnimationFrame(tick);
  };

  window.botStatus = function () {
    var avg = scores.length
      ? (scores.reduce(function (a, b) { return a + b; }, 0) / scores.length).toFixed(1)
      : 0;
    console.log(
      "Games: " + totalGames +
      " | Best: " + botBest +
      " | Avg: " + avg +
      " | Running: " + running
    );
  };

  console.log("=== STARFLING AUTO-PLAYER ===");
  console.log("Controls: stopBot() | startBot() | botStatus()");
  requestAnimationFrame(tick);
})();
JohnnyLaruetoday at 5:20 AM

I have never been worse at a game than I am at this one

show 1 reply
panstromektoday at 8:34 AM

The game is pretty fun. Page height is a bit wrong on mobile, you probably need some dvh height?

show 1 reply
weezingtoday at 12:07 PM

Lack of proper physics really bothers me in such game.

ofjcihentoday at 1:36 PM

56 Stars Better than 100% of players

Git rekd nerds

esttoday at 7:56 AM

hmm, it isn't strictly gravitational projectile movement isn't it?

rustyhancocktoday at 7:10 AM

Love it, but bro you got to make the process of staying playing in the first 2 minutes simpler.

Right now the first 5 or so times you miss. Probably the first 5 times you try.

You get an annoying process of having to shift you hand to press the play again button.

The solution is easy as checking what the game score and high score is, if it's 0 just restart.

I don't need or want to hear about how to sign up to your mailing list if I've just fallen flat on my face!

There's a reset button but it seems to do nothing and you end up at the play again screen.

russellbeattietoday at 6:28 AM

The use of the Web Vibration API Navigator.vibrate() is well done! I haven't seen it used much, but it really adds to the game.

(Apparently iOS still doesn't support it [1]? It's been in Chrome for the past 12 years. Maybe someday.)

1. https://developer.mozilla.org/en-US/docs/Web/API/Vibration_A...

kortextoday at 7:47 AM

Super fun! But the text does get in the way mid-combo.

oliver236today at 2:32 PM

allow me to use space and not click!!!!

🔗 View 13 more comments