Some days ago I saw on Instagram a video where a guy hacked the famous game of Google so I have recreate it but a little more complex. (At home I don't have so much componets and cause of quarantine I can't go out to buy it so the video is about the V1 of this project but schematics and code are about the VF (final version)).
Have you ever play at the game of the dino when connection doesn't work? How many time have you lose at this game? I have the hack perfect for you.
V1For this version of the project you must have an Arduino (Uno is enough), a photoresistor, a resistor of 10KΩ, a breadbord, a micro servo and some scotch.
With this version you can only arrive around 500 points, until the pterodactyl, and you can find che code commented into the section of the code. For the schematic is the same, but use only one servo and one photoresistor, while the video show you how it works :) (The video show how the project work until pterodactyls, then I gave it a little hand).
VFFor this version you can follow the code and the schematic of this project. Now you haven't problem because one servo is for the jump and the other is for lower the dino. The photoresistors are one for the cactus or low pterodactyl, one for medium pterodactyl and one for the background.
SETTING OF THE PHOTORESISTORTake one of your componets and attach it to the screen really near like that
then open the arduino ide and write this code
void setup() {
Serial.begin(9600);
}
void loop() {
int val=analogRead(A0);
Serial.println(val, DEC);
}
so connect arduino to the computer and upload the code, then open the serial monitor and make some tests. Set the screen at the max brightness -1 (go to the max and turn back of one click). See what value the photoresistor see on a white screen like Google page and on a black screen like windows start (this second value is the value to insert instead of the variable 'jump' in the code.
SETTING OF THE SERVOTake the servos and write this code on arduino ide
#include <Servo.h>
Servo up;
Servo down;
void setup(){
up.attach(9);
down.attach(10);
}
void loop(){
up.write(0);
down.write(0);
}
Now disconnect arduino from the computer and whitout move the servo insert the helix like in the photo
I set the servo in base of my keyboard, so they haven't to do a complete rotation, beacuse it isn't necessary, but only from 0 to 30 and back, logically set it in base of your keyboard.
ASSEMBLYFollow the schematic for the circuit, then open chrome://dino and make a game without this hack. Now you can position all the components. Attach the photoresistors on the screen in the middel (for x axis), one near the ground of the game (A0), one above (for pterodactyl-A1) and one everywhere you want (A2). If you don't want to ruin your screen you can use a piece of paper like in the photo
then you can set the servos, one on the spacebar (9) and the other on the down arrow(10).
PROBLEM WITH THE SPEED OF THE GAME?If the game is too fast for your photoresistors you can slow down it.
Go to chrome://dino and right click, ispection, console and write this
Runner.instance_.setSpeed(x)
Where x is the value that you can give at the dino. (0.5 slow, 100 fast), if you want you can also modify the jump of the dino with this
Runner.instance_.tRex.setJumpVelocity(x)
Now you are ready to play! Connect arduino to the computer and enjoy the game!!
p.s I've never test the code of VF so I don't really know if it will work without problem. I will try it when I will have the other two photoresistors and then I will update this project. For everything you can write me on Instagram.
Enjoy! :)
Greta Galli
Comments
Please log in or sign up to comment.