Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asteroid implementation #543

merged 16 commits into from
Aug 12, 2020


Copy link

@IsaacLic IsaacLic commented Aug 2, 2020


This PR contains an implementation for ECS-based asteroids. As of now, most of the asteroids in-game are still the old OOP asteroids, but there is a golden asteroid that uses the new component-based structure.

When the ship collides with the golden asteroid, they both take damage, the same way they would if the asteroid was a regular one. When the golden asteroid dies, it creates Money objects. As of now, the asteroid cannot be shot, because Projectiles don't collide with entities. I'm working on that now.


The testing code is currently built in - if you start the game, there will be a golden asteroid visible that has a working collision mesh. If you ram into it, you'll take damage as usual. I set its health to one, so to destroy it, ram into a a few times from far away or use a Loaded Imperial Large ship (they do a lot of collision damage). It should drop money upon being destroyed. As of now, I haven't developed collision with Projectiles, so shooting it won't work.

Outstanding Work

I need to add damage events to asteroids that get shot, and I need to move the body creation into a generic, non-asteroid class. The collision mesh is also slightly misaligned, so it needs to be fixed. In addition, I need to have asteroids produce rubble when destroyed. Once those things are done, I'll replace the existing asteroids with ECSteroids.

@IsaacLic IsaacLic mentioned this pull request Aug 5, 2020
Copy link

@Cervator Cervator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this is some code! Solid work, the PR works as-is for testing locally, I can ram the asteroid successfully and have it blown up then trigger the expected error we talked about on chat :-)

To me it looks really nice (and some excellent javadoc in some places), would like some more technical feedback from @NicholasBatesNZ and/or @Adrijaned. I've left an initial round of comments mostly on code quality, naming, comments, etc. But I seriously think we could consider merging this in the near future even with the debug code in place (so long as we don't do a release with it sitll active) to keep up this new velocity :-)

Very good work! Thrilled to see this and test it!

config/gradle/common.gradle Show resolved Hide resolved
float angle = entity.getComponent(Angle.class).get().getAngle();
ArrayList<RenderableElement> renderableElements = entity.getComponent(Renderable.class).get().elements;

//Body creation black box
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you expand on this comment a bit please, particularly for users unfamiliar with the area?

Copy link

@NicholasBatesNZ NicholasBatesNZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff, will merge now and we can take care of the TODOs later 👍

@NicholasBatesNZ NicholasBatesNZ merged commit 5a5153c into MovingBlocks:develop Aug 12, 2020
@NicholasBatesNZ NicholasBatesNZ added this to the v2.1.0 milestone Aug 12, 2020
@IsaacLic IsaacLic deleted the asteroidImplementation branch October 11, 2021 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants