Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

Students also viewed these Databases questions

Question

Be familiar with the five basic ways to manage demand.

Answered: 1 week ago