Coding Challenge #46.2: Asteroids with p5.js - Part 2

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=xTTuih7P0c0



Duration: 31:04
57,720 views
1,004


In this two part coding challenge, I use the p5.js library to create my own version of the classic Atari video game Asteroids! Code: https://thecodingtrain.com/challenges/46-asteroids

πŸ•ΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/VtYr6E4_M

πŸŽ₯ Next video: https://youtu.be/JUDYkxU6J0o?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸ”— Asteroids on Wikipedia: https://en.wikipedia.org/wiki/Asteroids_(video_game)

Videos:
πŸŽ₯ Asteroids Part 1: https://youtu.be/hacZU523FyM
πŸŽ₯ Polar Coordinates: https://youtu.be/O5wjXoFrau4
πŸŽ₯ Livestream Archive: https://youtu.be/VFnF87-JNtY

Related Coding Challenges:
πŸš‚ #81 Circle Morphing: https://youtu.be/u2D4sxh3MTs

Timestamps:
0:00 Asteroids - Part 2
0:49 Add a Laser object
7:13 Add collision detection
11:44 Add a breakup function
15:38 Loop through the asteroids backwards
19:38 Use concat to add the new asteroids to the array
22:47 Remove the asteroids if their size falls below a threshold value
24:13 Check if the ship hits the asteroid
26:03 Possibilities for variations
27:00 Remove lasers that are offscreen

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://discord.gg/hPuGy2g
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain
πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/

πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: https://p5js.org
πŸ”— p5.js Web Editor: https://editor.p5js.org/
πŸ”— Processing: https://processing.org

πŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new

#atariasteroids #polartocartesiancoordinates #p5js #javascript







Tags:
JavaScript (Programming Language)
live
programming
daniel shiffman
creative coding
p5.js
coding challenge
p5.js tutorial
p5js
javascript (programming language)
tutorial
javascript
algorithms
asteroids
atari asteroids
asteroids p5js
asteroids javascript
asteroids game js
asteroids game javascript
asteroids game atari js
coding
challenges
games done quick
html5 canvas game
game javascript
asteroids game bot
asteroids machine learning