100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Animation and Games CodeHS- Test Questions & Answers

Rating
-
Sold
-
Pages
39
Grade
A+
Uploaded on
31-01-2025
Written in
2024/2025

Animation and Games CodeHS- Test Questions & Answers

Institution
Codehs
Course
Codehs











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Codehs
Course
Codehs

Document information

Uploaded on
January 31, 2025
Number of pages
39
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Animation and Games CodeHS- Test
Questions & Answers
In the following code:

var ball;

function start(){

ball = new Circle(20);

add(ball);

setTimer(draw, 20);

}

function draw(){

ball.move(2, 2);

}

When will the function draw be called? ✔️Correct Ans-Every 20 milliseconds




Which statement will call a function animate every 50 milliseconds? ✔️Correct Ans-
setTimer(animate, 50);



9.1.5 Crazy Ball ✔️Correct Ans-var RADIUS = 100;

var circle;

function start(){

circle = new Circle(RADIUS);

circle.setPosition(getWidth()/2, getHeight()/2);

,add(circle);

setTimer(crazyBall, 100);

}

function crazyBall(){

var x = Randomizer.nextInt(RADIUS, getWidth()-RADIUS);

var y = Randomizer.nextInt(RADIUS, getHeight()- RADIUS);

circle.setPosition(x,y);

circle.setColor(Randomizer.nextColor());

}



What does this program do?

function drawCircle(x, y, radius, color){

var circle = new Circle(radius);

circle.setPosition(x, y);

circle.setColor(color);

add(circle);

}

function start(){

setTimer(draw, 50);

}

function draw(){

var color = Randomizer.nextColor();

var centerX = getWidth()/2;

,var centerY = getHeight()/2;

var radius = 100;

drawCircle(centerX, centerY, radius, color);

} ✔️Correct Ans-Draws several randomly colored circles at the center of the canvas by drawing 1
every 50 milliseconds.



Which statement would stop the timer in the following program?

function drawCircle(x, y, radius, color){

var circle = new Circle(radius);

circle.setPosition(x, y);

circle.setColor(color);

add(circle);

}

function start(){

setTimer(draw, 50);

}

function draw(){

var color = Randomizer.nextColor();

var centerX = getWidth()/2;

var centerY = getHeight()/2;

var radius = 100;

drawCircle(centerX, centerY, radius, color);

} ✔️Correct Ans-stopTimer(draw);

, 9.2.5: Growing Circle ✔️Correct Ans-var START_RADIUS = 1;

var INCREMENT = 1;

var CHANGE_COLORS_AT = 10;

var circle;

var MAX_RADIUS = 240;

var counter = 0;

function start(){

circle = new Circle(START_RADIUS);

circle.setPosition(getWidth()/2, getHeight()/2);

add(circle);

setTimer(draw, 50);

}

function draw(){

START_RADIUS = START_RADIUS + INCREMENT;

circle.setRadius(START_RADIUS);

counter++;

if(START_RADIUS % 10 == 0){

circle.setColor(Randomizer.nextColor());

}

if(counter == MAX_RADIUS){

stopTimer(draw);

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TheeGrades NEWCASTLE UNIVERSITY
View profile
Follow You need to be logged in order to follow users or courses
Sold
97
Member since
1 year
Number of followers
5
Documents
12923
Last sold
2 weeks ago
THEEGRADES

Ace Your Exams with Premium Study Guides! Unlock your full potential with our expertly crafted revision materials. Whether you're prepping for exams, quizzes, or looking to solidify your understanding, we've got you covered. Our study guides, summaries, and test banks are designed to simplify complex topics and enhance your knowledge retention. What We Offer: Comprehensive Summaries: Key points made easy for quick revision. Test Banks: Practice with real exam-like questions. Exam Prep Guides: Focused content to boost your scores. Instant Access: Download and start studying immediately! Don’t just study harder—study smarter! Excel in your exams with our trusted materials. You are Welcome. SUCCESS!!!

Read more Read less
3.3

24 reviews

5
9
4
4
3
3
2
1
1
7

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions