Question: why my program is crashing on after first animation? package Main; import java.awt.Color; import logic.Control; import timer.stopWatchX; import java.util.Queue; import java.util.LinkedList; import Data.Vector2D; public class

why my program is crashing on after first animation?

package Main; import java.awt.Color; import logic.Control; import timer.stopWatchX; import java.util.Queue; import java.util.LinkedList; import Data.Vector2D;

public class Main{ // Fields (Static) below... public static Color c = new Color (255, 0 , 0); public static boolean isImageDrawn = false; public static stopWatchX timer = new stopWatchX(350); public static Queue vecs1 = new LinkedList<>(); public static Queue vecs2 = new LinkedList<>(); public static Vector2D currentVec = new Vector2D(100, 50); // End Static fields... public static void main(String[] args) { Control ctrl = new Control(); // Do NOT remove! ctrl.gameLoop(); // Do NOT remove! } /* This is your access to things BEFORE the game loop starts */ public static void start(){ // TODO: Code your starting conditions here...NOT DRAW CALLS HERE! (no addSprite or drawString) for (int x = -128; x <= 1280 + 128; x += 50) { vecs1.add(new Vector2D(x, 250)); } } /* This is your access to the "game loop" (It is a "callback" method from the Control class (do NOT modify that class!))*/ public static void update(Control ctrl) { // TODO: This is where you can code! (Starting code below is just to show you how it works) //if(isImageDrawn) ctrl.addSpriteToFrontBuffer(currentVec.getX(), currentVec.getY(), "kb"); // Add a tester sprite to render list by tag (Remove later! Test only!) ctrl.drawString(20, 150, " Khush Bakhat ", c); // Test drawing text on screen where you want (Remove later! Test only!) //while(!vecs1.isEmpty()){ if(timer.isTimeUp()){ //isImageDrawn = !isImageDrawn; currentVec = vecs1.remove(); vecs2.add(new Vector2D(currentVec.getX(), currentVec.getY())); timer.resetWatch(); } } // Additional Static methods below...(if needed) }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!