Sara Beheshti
← Back to Assignments

Assignment 1

Dunphy the spider is trying to catch Jay the fly by moving and jumping on the steps.

This is an interactive game-like sketch of a spider moving to catch a fly. Description:

- First Dunphy the spider standing below the stairs(steps) and the fly is moving vertically on top of the last step. The flickering background is supposed to resemble game interfaces.

- Both their eyes (pupils) move by the mouse as defined in p5.js (mouseX,mouseY).

- The movement of Jay the fly defined through random numbers between -20 to 20 in y direction.

- Jay the fly can also move by the Boolean variable of mouseIsPressed.

- Dunphy the spider jumps by pressing the "space" key on keyboard.

- If you press the "Right Arrow" key button once, Dunphy starts moving forward and lands on the first step ahead. Keep pressing "Right Arrow" button to see Dunphy the spider jumping and landing on the steps ahead.

- When Dunphy reaches the last step, Jay escapes to the left.

- The same movement happens to the left if you press "Left Arrow" key button. Dunphy turns back, jumps to the left and lands on the left step. When Dumphy reaches the last step and we push the "Left Arrow", it turnes back and jumps to the previous step, up which the fly is flying vertically now. This time, Dunphy succeeds to catch the fly and from now own they move together to the left or right by pressing left or right arrow key buttons respectively.

View the code repository on GitHub