top of page
Snake - Snapchat Lens
Anchor 1
_environment
​
_role
_tools
​
_description
Personal Project
Software Developer
Javascript, LensStudio
This project is a mobile filter that lets users play the game "Snake" using only their camera lens and their head. The direction of the user's head determines the direction of the snake: turning your head to the left causes the snake to turn left, turning your head up makes the snake go up, etc. The game follows the traditional rules of Snake and ends when the snake hits the wall or hits itself.
_code
_process
next loop
For this project, I loosely followed this Coding Train tutorial by Dan Schiffman on establishing the gameplay for the snake game. However, the mechanics for lens studio varied significantly from p5.js. Instead of drawing over the canvas on every frame like in p5.js, I had to move each instance of an a snake segment in order to get the snake to move across the screen.
In order to make this game utilize the affordances of LensStudio, I modified the controls to respond to head movement. Using, simple conditional operators and head rotation, I calculated appropriate thresholds for when to trigger
rotate head right or left
Snake moves right or left
rotate head up or down
Snake moves up or down
_demo_Video
Open up SnapChat
to unlock!
bottom of page