Workshop activities | Essay Furious

Workshop activities

page16image32002944

Activity R7-1 *** Portfolio Activity ***

The following activities are to be recorded in you’re the Portfolio word document under the heading Activity R7-1.

  1. Declare and initialise a String array called food with the names of three different types of food that you may use in your game. You may wish to use the food you already use and/or create new food names.
  2. Using a while loop, write the code that will play one of your games’ sound files 7 times.
  3. Consider the following code:
  4.       int x = 25;
  5.       int i = 1;
  6.       while (i < 5)
  7.       

x = x – 5;

i += 1;

What is the value of x after this code has executed? What is the value of i after this code has executed?

Activity R7-2

  1. Open the scenario called bubbles. You will see that the world is empty. Place some Bubble objects into the world, using the default constructor. Remember you can also do this by shift-clicking into the world. What do you observe? ________________________________________________________________________ ________________________________________________________________________
  2. What is the initial colour of a new bubble? ______________
    What is its initial size? ___________________________
    What its initial direction of movement? ______________________________________
  3. In the world subclass, Space, create a new private method called setupObjects(). Call this method from the constructor. In this method, create a new bubble, using the default constructor, and place it in the centre of the world. Compile, then click Reset a few times to test.
  4. Change your setupObjects () method so that it creates 13 bubbles. Use a while loop. All bubbles will be placed in the centre of the world. Run your scenario to test.
  5. Place the 13 bubbles at random locations in the world.
  6. Save your program as ActivityR7-2.gfar.
page16image32215312
page16image17489984

PROG1001 Module 7 – Page 15

page17image31739552

Activity R7-3

Using your program from Activity R7-2, alter your code to place the bubbles on a diagonal, with x and y distances of 35. The first bubble will be at (0,0), the next at (35,35) and so on. Do this for 13 bubbles. Use your loop counter variable to achieve this.

1. What position is the final bubble located? Save your program as ActivityR7-3.gfar.

Activity R7-4

Using your program from Activity R7-3, alter your code to place the bubbles on a diagonal, so that they go from the top left corner of the world to the bottom right corner. The last bubble should be at 900,600 or sometimes (899,599).

Create another diagonal line that starts at the top right-hand corner of the world and goes to the bottom left corner of the world. The last bubble should be at 0,600 or sometimes (1,599).

Save your program as ActivityR7-4.gfar.

Activity R7-5

Using your program from Activity R7-4, alter your code to add a second while loop to your setup() method that places some more bubbles.

This loop should place 10 bubbles in a horizontal line, starting at x = 100, y = 11, with x increasing by 40 every time and y being constant.

The size of the bubble should also increase, starting with 10 for the first bubble, then 20, then 30 etc. Use the second Bubble constructor for this (the one with one parameter).

Save your program as ActivityR7-5.gfar.

Activity R7-6

Remove the existing loops from your setup() method.

Write a new while loop that does the following:

  1. creates 18 bubbles
  2. places the bubbles in the centre of the world, with sizes starting from 190, and decreasing by 10.
  3. the last bubble should have size 10.

Make sure to create the largest first and the smallest last, so that you have bubbles of sizes 190, 180, 170 etc all lying on top of each other.

Use the third constructor of Bubble – the one with two parameters. It also lets you specify the initial direction. Set the direction as follows: the first bubble has direction 0, the next 20, the next 40 etc. Test

Save your program as ActivityR7-6.gfar.

page17image31722960
page17image31723168
page17image31723376
page17image17115456

PROG1001 Module 7 – Page 16

page18image31855072

**** Activity R7-7 Portfolio Activity ***

The following activities assumes that you have completed the previous Bubble Scenario workshop activities. You will use the concepts from those activities in the next few activities.

This activity will update your existing game you created for Assessment 2 – Practical skills. Each Activity, when it is completed, should be saved as a gfar in your portfolio folder.

For the next few activities you will be using code to add new Actor objects to your scene. Remove all the code within the prepare method so that no objects are added to the scene. You will be starting with an empty prepare method. If you called your prepare method something different just remove all the code from that method.

In your games’ World class that you created (not the actual World class):

  1. In the prepare method, write a line of code to create a new Player object ready to be added to the world.
  2. Also, in the prepare method, add code to add the new Player object to the middle of the world.
  3. You will now need to add code to record and display a score. You should implement Abstract scoring for your game by referring to Activities 6-15 through to 6-19 from the previous Topic.

Save your program in the Portfolio folder as ActivityR7-7_rmason10.gfar. Replace rmason10 with your username for MySCU.

**** Activity R7-8 Portfolio Activity ***

The following activities assume that you have completed the previous activity.
This activity will update your existing game you created for Assessment 2 – Practical skills. Each

Activity, when it is completed, should be saved as a gfar in your portfolio folder. In the prepare() method you will now setup the world. Using ‘while loops‘:

1. create and add ten (10) Food objects to the world in a horizontal line. The starting position of the first Food object should be set to 100 pixels from the left and 40 from the top of the World. Make x increase by 40 pixels for each new Food object created,

2. create and add three (3) Enemy objects to the world in a vertical line. The starting position of the first Enemy object should be set to 20 pixels from the right and 100 from the top of the World. Make y increase by 40 pixels for each new Enemy object created.

Make sure to test your game by resetting it and checking to make sure that all the objects appear at the correct positions in the World, as shown below (next page):

page18image31855280
page18image17070528

PROG1001 Module 7 – Page 17

page19image31867504

Save your program in the Portfolio as ActivityR7-8_rmason10.gfar. Replace rmason10 with your username for MySCU.

**** Activity R7-9 Portfolio Activity ***

The following activity assumes that you have completed the previous workshop activities as well as the scoring in activity R7-7.

This activity will update your existing game you created for Assessment 2 – Practical skills. Each Activity, when it is completed, should be saved as a gfar in your portfolio folder.

1.Modify your game so that when the Player touches a Food object, the Food object is removed (you may have this already), and 2 points are added to the score.

2.Modify your game so that when the Player touches an Enemy object, the Enemy object is removed, and 10 points are deducted from the score.

Make sure that you test your game, resetting it after each change. Check to make sure that all the objects appear at the correct positions in the World and that they interact with each other appropriately.

Save your program in the Portfolio as ActivityR7-9_rmason10.gfar. Replace rmason10 with your username for MySCU.

WE’VE HAD A GOOD SUCCESS RATE ON THIS ASSIGNMENT. PLACE THIS ORDER OR A SIMILAR ORDER AND GET AN AMAZING DISCOUNT

The post Workshop activities | Essay Furious appeared first on essayfurious.com.

Reference no: EM132069492

WhatsApp
Hello! Need help with your assignments? We are here

GRAB 25% OFF YOUR ORDERS TODAY

X