Devlog: Adding Asteroids and Polishing the Universe


Devlog: Adding Asteroids and Polishing the Universe

This session was packed with new features and a ton of quality-of-life improvements that make the game feel more interactive and polished. Here’s a breakdown of what we accomplished.

New Core Feature: Asteroid Mining

The biggest addition is a brand-new asteroid spawning system. This gives players an active way to gather resources by clicking on objects moving across the screen.

  • Asteroid Manager: We created a new singleton, AsteroidManager, responsible for spawning asteroids. It randomly selects an asteroid type, determines a starting position just off-screen, and gives it a random trajectory and speed.
  • Asteroid Entity: A new asteroid.tscn scene and asteroid.gd script were built. Each asteroid has its own health, moves across the screen, and can be clicked.
  • Click & Collect: Clicking an asteroid damages it and provides the player with a small number of resources. If the main space station’s storage is full, these resources are automatically sold for gold, providing a useful overflow mechanic.
  • Feedback System: Clicks are accompanied by a pulse effect, and floating text numbers appear at the asteroid’s location (in white) and at the space station (in green) to show the resources gained.

Polishing the Payoff: The Perfect Asteroid Explosion

Getting the destruction effect just right took a few iterations, but the result is fantastic. When an asteroid’s health reaches zero:

  1. The explosion animation (currently a black hole) plays.
  2. A Tween simultaneously triggers three effects on the visual node:
    • A quick, intense shake effect.
    • A smooth fade-out to transparency.
    • A scaling effect, shrinking the asteroid down to nothing.
  3. Once the animation is complete, the node is removed from the scene.

Major Quality of Life & Control Upgrades

We made significant changes to how the player controls the main space station to make it more intuitive and robust.

  • Physics-Based Movement: The SpaceStation was converted from a Node2D to a CharacterBody2D. Planets and the sun were converted to StaticBody2Ds. This introduces real physics, preventing the station from flying through celestial bodies. The movement logic was updated to use velocity and move_and_slide().
  • Refined Mouse Controls: The biggest UX improvement! Station movement is now bound to the right mouse button. This completely separates the “move” action from the “interact/click” action (left mouse button), resolving all conflicts where clicking on a planet or asteroid would also move the station.
  • Keyboard Controls: Players can now also pilot the station directly using the arrow keys (ui_up, ui_down, ui_left, ui_right).

UI/UX Refinements

A lot of work went into making the UI clearer and more visually consistent.

  • Manager Cards:
    • Logic Fix: The “Remove” button now correctly only appears on a manager card if that manager is currently assigned to a planet.
    • Visual Polish: The card’s border is now colored according to the manager’s rarity (Common, Uncommon, Rare, Epic), matching the color of their name for a cohesive look. This was also applied to the manager upgrade cards in the Research panel.
    • Readability: The bonus text on manager cards now uses line breaks instead of commas, and the font size was adjusted for better readability.
  • Planet Panel:
    • Live Editing: The planet.gd script is now a @tool script, allowing for real-time adjustments in the editor. We exposed the locked_color property, so we can tweak how dark a locked planet appears directly in the Inspector.
    • Consistent Previews: The preview for a locked planet inside its panel now perfectly mirrors its appearance in the main game scene, showing the darkened planet with a large question mark over it. We also exposed offset properties to fine-tune the positioning of these elements in the editor.

This session was incredibly productive. The new asteroid system adds a fun layer of interaction, and the numerous control and UI fixes make the entire experience feel much more professional and enjoyable.

Files

exports1.zip Play in browser
2 days ago

Leave a comment

Log in with itch.io to leave a comment.