Noises & Signals

Contemplations on creativity in our digital age

Tag: assignments

Touchscreen pong with p5

…so it’s not exactly an “extreme” or “ultimate” game of pong, but the challenge led me to try some previously unexplored functions in p5.js. This version currently works only with touch screens and is sized specifically for an iPad air:  (p5 source code is available here)
p5 pong game screenshot

Particularly interesting elements of developing the game for me were:

  • Coding the scoring system. Points are gained by each player when the small light blue marble “ball” hits one of the 3 larger marbles in the center (based on the direction of the ball). The 2 outer targets are worth 10 points, the middle is worth 20. The numbers display the accumulated score for each player; however, if a player misses the ball with their paddle, they lose all of the points that they scored during that round (their score resets to that of the previous round). The target hit detection makes use of p5’s dist() function.
  • Using the oscillators and envelopes in the p5.sound library. This example was particularly helpful in getting started with sound generation, though I by-passed the MIDI note conversion and am providing the oscillator with a specific frequency value. Also, to prevent an audible note from immediately playing at the start of the game, the oscillator is creating a super-low frequency of 1 Hz until a target is hit and a different tone is played…a bit of a hack until I come up with a better solution.
  • Use of the built-in touches array to detect fingers on a touch screen. I found the short example sketch listed in the first response from lmccart on this page to be quite useful in figuring out how to track (and limit the number of) touches on a screen. The paddles and ball won’t move unless at least one finger is on either side.
  • Changes in velocity depending on which part of the paddle hits the ball. Basically using a combination of the map() function and some hit-or-miss experimentation with calculations for this – the ball will move slower and more vertically straight when it hits the center of a paddle, and the angle and speed increases greatly towards the edges.

Inspiration from a unlikely source

In considering how to present the second scene in my short video project – the ad promoting the promise of the self-recording technology, I know that I want to avoid any overall voice narration. The Google “Year in Search” videos rely heavily on text interspersed between video segments…I like this approach, and it made me think of another ad campaign from the late 80s that intrigued me as a teenager:

Oooooo, the luring questions that appear as simple text, with the promise of answers and revelations provided in the book. Fortunately, after reading it (and even being interested in its contents), I did not become a Scientologist. (And in fact, it made me curious enough to read an anti-Scientology book that exposed the hypocrisy and abuse that existed in the “church”.) At this point, however, it serves as inspiration for a visual approach…

Protected: Further thoughts and variations on the first video assignment

This content is password protected. To view it please enter your password below:

Protected: Draft of storyline for first 4010 video project

This content is password protected. To view it please enter your password below:

© 2020 Noises & Signals

Theme by Anders NorenUp ↑