Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c70sp/asteroidsclone
Little Asteroids clone I made from skretch, not supposed to be a 1:1 copy, but rather just be similar and fun
https://github.com/c70sp/asteroidsclone
asteroids asteroids-clone asteroids-game games js oop vanilla-javascript vanilla-js
Last synced: about 15 hours ago
JSON representation
Little Asteroids clone I made from skretch, not supposed to be a 1:1 copy, but rather just be similar and fun
- Host: GitHub
- URL: https://github.com/c70sp/asteroidsclone
- Owner: c70sp
- License: mit
- Created: 2024-11-07T15:02:27.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-14T11:52:05.000Z (3 months ago)
- Last Synced: 2024-11-14T12:35:34.440Z (3 months ago)
- Topics: asteroids, asteroids-clone, asteroids-game, games, js, oop, vanilla-javascript, vanilla-js
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Small and dynamic Asteroids clone
Arrow left / right to turn
Arrow up / down to accelerate
Spacebar to shoot
Enter to resetThe asteroids and the spaceship are fully customizable via objects/asteroids.js and objects/spaceship.js respectively
## Asteroid generation
> Asteroids are generated by first creating a circle with a radius defined by `rad`.
> Around this circle, `amountPoints` are evenly distributed.
> From each of these points, a line is drawn towards the center of the circle (illustrated as an orange line) with a length of `vecLength` and an inset of `vecInset`.
> Each line is then rotated within a range of ±`maxAngle` degrees (for example, a max angle of 45° would allow for a rotation between 45° clockwise and 45° counterclockwise), resulting in the final orientation of each line (shown as the green line).
> Between the endpoints of these rotated lines, the final points (shown as red points) will be generated, which are connected with line segments to form the irregular shape of the asteroid.
> For now the collision detection is just based on the circle.
> These different lines and points can be shown by changing this.display in js/objects/asteroid.js