WP2WS – W01 – Bouncing Sandwich (Coding Practice)

Code Link

For this week’s assignment, I utilized basic p5.js shapes, transformations, and vector math to create a bouncing sandwich.

I started by creating a bouncing shining ball we learned in class. Imitating real-world physics through coding is very interesting for me, so I decided to make something similar. 

Lonely ball

After creating the used rectangle, I play with different parameters to present the real trampoline effect as much as possible. However, if I decrease the speed when the sandwich is bouncing back, it will bounce back higher and higher and finally disappear on the screen with time passing by.

Demo video

CGDD – W01 – C# Challenges

Difficulties
  1. C# has two sets of logic AND&OR, the first set is binary operators that evaluate both operands, | and & (as well as ^); the second set is conditional logic operator, || and &&. I mixed them while writing the if statement.
  2. While trying to control the car speed, even though I wrote the change as 0.1f, the number printed out is not always a finite decimal. 
  3. About arrays! I have met a lot of errors telling that “cannot implicitly convert GameObject() to int” and etc, but generally they are fixable. For instance, when writing the for each loop, I forgot to convert the int to Gameobject so the error kept jumping out.
Documentation

*Some links do not directly show video format for no reason, please just click the link

Variables

Create Variables

Small Story

If Statement

Car Speed Control 1

https://youtu.be/4INmug7bzrE

Car Speed Control 2

https://youtu.be/wH2uokt2fsw

Car Speed Control 3

Switch Statement

Color Setter

Weapon Selector

Array

Array I

https://youtu.be/VWS5mMb4jQc

Array II

Loop

For loop

For each loop

Methods & Functions

Move

Change color

Distance Value

https://youtu.be/oNu81zL29Bg