Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

GAME PROGRAMMING JAVA CAN YOU PLEASE Change the TestGame class code so that three different sprite objects (with different images) are drawn. Upload an image

GAME PROGRAMMING JAVA

CAN YOU PLEASE

Change the TestGame class code so that three different sprite objects (with different images) are drawn. Upload an image containing a picture/screenshot of running the TestGame class that shows the three different sprite objects.

TestGame

public class TestGame extends Game { Sprite ball;

public void initialize() { setTitle("Test Game"); setWindowSize(800, 600); System.out.println("Hello, world!");

ball = new Sprite(); ball.setPosition(10, 10); ball.setTexture( Texture.load("images/basketball.png") ); ball.setSize(50, 50);

group.add(ball); }

public void update() { if ( input.isKeyPressed("RIGHT") ) ball.position.addValues(2, 0);

if ( input.isKeyPressed("LEFT") ) ball.position.addValues(-2, 0);

if ( input.isKeyPressed("UP") ) ball.position.addValues(0, -2);

if ( input.isKeyPressed("DOWN") ) ball.position.addValues(0, 2);

if ( input.isKeyJustPressed("Z") ) ball.position.setValues(0, 0); } }

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_2

Step: 3

blur-text-image_3

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago