Question: 5. Consider the following code fragments which initialize and update variables for a small sprite moving in an unusual gravitational field across a 200 by

 5. Consider the following code fragments which initialize and update variables

5. Consider the following code fragments which initialize and update variables for a small sprite moving in an unusual gravitational field across a 200 by 200 pixel window. //Initialization (run once) int x = 180; int y = 20; int dx = = -20; int dy 20; //Position and Velocity Update (run each frame) x += dx; Y += dy; dy -= 10; a)(4 pts) Where on the window (i.e. top-left corner, bottom edge, etc.) is the sprite initially located? b)(4 pts) Which direction is the sprite initially moving? c)(5 pts) Which boundary (top, bottom, right, or left side) will the sprite run into first? 6.(12 pts) Below is the first line of a method to check if the point with coordinates (px, py) is contained within a rectangle whose top left corner is at (rx, ry) and has width w and height h. Just working with inequalities (e.g. not using the JavaFX class BoundingBox), fill in the body of the method which will return true if the point is in the rectangle and false otherwise. boolean Point Isin(int px, int py, int rx, int ry, int w, int h) {

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!