Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1: what does frameCount mean? Question 2: What does size(300, 300) mean

ID: 3594632 • Letter: Q

Question

Question 1:  

what does frameCount mean?

Question 2:

What does size(300, 300) mean?

Question 3:

The above program will create an animation from a spritesheet. Modify the program to make the animation play faster. You only need to write down what to change (you don't have to write the whole program).

Question 4:

Can we move the statement "background(0);" to the end of the draw() function, i.e. after the statement "image(sprite, mouseX, mouseY);"? Explain why.

Read the following program, and answer the questions 1-4 PImage spritesheet = loadImage("http://www.norden felt-thegame.com /blog/wp-content/uploads/2011/11/explosion_transparent.png") int DIM 5; int w spritesheet . width/DIM; int H-spritesheet.height/DIM: void setup) size (300, 300) imageMode (CENTER) noCursor ) frameRate (24) void draw) background (0) int y = frameCount/DIM&DIM; * H; PImage spritespritesheet.get (x, y, W, H) image (sprite, mousex, mouseY)

Explanation / Answer

[1]
The system variable frameCount contains the number of frames that have been displayed since the program started. Inside setup() the value is 0, after the first iteration of draw it is 1, etc

[2]

Defines the dimension of the display window width and height in units of pixels. In a program that has the setup() function, the size() function must be the first line of code inside setup().

size(300,300) will assign 300 to the width variable and 300 to the height variable

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote