Week 4 | Assignment
Clean Code
Click on the Player to Drag & Drop anywhere on the field.
Apart from cleaning up the code via the use of function(), I also added and tweaked the sketch a little bit from last week. The added features are:
- Ball's movement trials.
- Player's movement trials.
- The ball now bounce within the field.
LEFT: Cleaner Code: https://alpha.editor.p5js.org/projects/ByRswwgA
RIGHT: Last Week (very long) Code: https://alpha.editor.p5js.org/projects/rkbsUwgC
I wonder if there is an easier way to attach or add .js files into the sketch.js file that I'm working on. From what I can tell p5 IDE cannot drag and drop file from a file in the IDE. In order for me to clean up a very long code from last week, I have to separate the player, the field, the ball into individual files, then downloaded them into my laptop, and then added these files back into a new sketch in the p5 IDE in the project-folder. Maybe, there is a way but I couldn't find it yet.