process
- Really interesting/nostalgic/surreal to spend time this week in code I wrote all the way back in Week 1 — things that took me literal hours to fine-tune the first time around I can now do in just a few clicks.
- Most challenging thing this week was using return() — conceptually it made sense to me, in practice it did not. I really wanted to try and make all of the different functions of my bouncing ball sketch portable by feeding variables back into draw(), but this step tripped me up.
- I went back and watched the Coding Train video for this a couple of a times, but couldn’t quite understand how to translate Shiffman’s example to the bouncing ball sketch. I could grasp how to return a number, but how to return a calculated variable that then feeds into other variables?
- (This ended up being fine for this week’s homework since this wasn’t a necessary step, but still not totally clear on how to actually use this tool for future functions).
- Creating a reusable bounce function also took a lot of unexpected turns:
- Started out trying to use global variables in my user-defined arguments, but they did not translate from where I declared my function in draw to the function definition (e.g. putting “bounce(x)” in draw(){ and then “function bounce(varToChange){” resulted in nothing)
- Thank you to Nasif for walking through the problem with B & I! His reframing it as going back to the easiest way to turn things on and off (i.e. if statements!) was super helpful for figuring out what kinds of variables could interact with the behavior that was already up and running.
references + resources