To explore Rust + wasm I made a version of the arcade game Asteroids. This version aims for a more physics-based feel; for example, the asteroids split where you hit them and move accordingly. This is my first such Rust project, and building this in Rust was a joy.
All hits should have some effect. A hit splits the asteroid through the line of the blast, resulting in two or more pieces; if a piece is small enough then it explodes. Bigger asteroids can't be destroyed in a single hit; they must be broken into smaller and smaller pieces. Does that help?
To be more realistic, the ship shouldn't have more friction than the asteroids. Without friction or gravity, the only way to decelerate is to accelerate backward (with only one motor, accelerating and decelerating take exactly the same time).
The bullets should not disappear suddenly (unless there is a self-destruct mechanism inside?), but the game would be very difficult... Maybe for a "realistic/hard mode"?
Nice game! My only issue is that my screen (and thus my browser page) is smaller than the game's frame. So when I push up to use the thruster, the browser treats that as a scroll event, and scrolls the whole game. In Chrome.
But I managed to play successfully without the thruster, using only the left, right, f and s keys. But detecting the browser frame size would be nice.
Dang this is cool, but damn near impossible to play on my Atreus keyboard. Any chance you could enable hjkl movements? Holding the layer key down for arrow keys means I can't press the F to fire unless I change layers again, lol.
I just started the Web Assembly with Rust book so I look forward to checking out the code!
Regarding "friendly fire", I feel like I've seen many versions of Asteroids make your bullets expire after a certain distance, so you can still do intentional wraparound without nearly as high a risk of shooting yourself.
Still very cool how close this is to a polished game considering how little code it takes.