/* Bruce A. Maxwell CS 153, Project 8 Fall 2018 Animate function for project 8 */ /* This function generates a series of lines that make it look like a dart is falling down. The speed of the drawing is governed by the vel argument, and the angle of the dart is determined by the y argument. The size of the target should probably be a parameter. */ int animate(float y, float vel) { int deltat = 3000 / vel; // distance / velocity = time float position = 20; const int Steps = 10; const int Screen = 40; const int TargetSize = 10; int targetStart = Screen/2 - TargetSize/2; int targetEnd = Screen/2 + TargetSize/2; char s[64]; if(vel < 3) { Serial.println("Scrub"); return(0); } for(int i=0;i= targetStart && i <= targetEnd ) s[i] = '='; } s[Screen] = '\0'; Serial.println(s); if( (int)position >= targetStart && (int)position <= targetEnd ) { Serial.println(" Winner!!!"); return(1); } Serial.println(" Missed!!!"); return(0); }