purple rain | coding challenge | the coding train(wreck)

Purple Rain Coding Challenge (#4)

This is the fourth coding challenge of Dan Shiffmans coding train youtube channel, ‘purple rain’. Well, it’s my version in p5js of his processing code. This is really an experiment in me learning p5js and eventually processing.  I also hope it helps re-motivate myself with ‘fun’ code rather than just endless forms, submits and radio buttons.

So here it is!

purple rain coding challenge exampel

Demo: here

github: here

This isn’t anything new to me.  I’ve done this rain effect thousands of times in the past 15  plus years.   I’ve  also gotten to the point of adding in wind and air resistance in the past. While I kept this simple to keep the flow or motivation going.

This was more of a practice of the mapping function in p5js. I like it though I’ve also lived without it for years so I’m sure it’ll take some time to really incorporate it in my thinking rather than just doing the percentage values myself. I really should test which is quicker.

There isn’t a lot different about this over Daniel Shiffmans version.  He did his in processing while i used js (i’m sure he has a js version somewhere).  The only really big difference is I created a ‘reset’ method in the ‘drop’ class to centralize the ‘resetting’ of a particle. nothing really unusual.

That all said I do believe the best way to learn a new language is to learn a simple particle system.  This is it.

What happened to #3?

Oh I did it. and I made it work on mobile(swiping). it’s on github I just kept working on it for a rediculously long time.  I even made graphic/sprites in sketchup for it.  yup, I made actual 3d models for it.

I did take a lot of time on it. Pretty much I spent too much time on it and did the one thing that I really hate that dev’s do, I made it way more complicated than it ever needed to be.  I also don’t feel that the instantiation of p5js is very intuitive with multiple classes being used. It actually turns into a trainwreck very quickly.

I want to push it further still but I was loosing motivation to continue working on it so I jumped on to the next challenge to get the drive back and to expose myself to more p5js.

The code is definitely a trainwreck so I stopped and started a 3.1 version. That version is more about the UI than the game so far. So don’t worry too much about that.

check it out so far here  (it does say press ‘enter’ – if you are on mobile – swipe to start)

OR as usually the trainwreck could just be me.

Leave a Reply