代写 C game ruby Faculty of Science, Engineering and Technology

Faculty of Science, Engineering and Technology
Introduction to Programming
Distinction Task 8.3: Food Hunter
Overview
This task allows you to expand your understanding of the Ruby programming language and to see how the principles and ideas from structured programming relate to Object Oriented programming.
Purpose: Task: Time: Resources:
Demonstrate that you can apply programming principles to modify a simple game program. Complete an extension of the provided Food Hunter code.
This task should be completed before the start of week 11.
Blackboard Ruby resources:
• Pine, C 2009, ‘Learn to Program’, Pragmatic Bookshelf (in the library)
• Sobkowicz, M 2015 Learn Game Programming with Ruby: Bring Your Ideas to Life
with Gosu, The Pragmatic Programmer.
• Tutorial for the gosu game package.
• Set of videos for Ruby.
Submission Details
You must submit the following files to Doubtfire:
■ Source code from the game.
■ Screenshots of the game in action.
■ Answer to a question on Programming Principles.

Introduction to Programming Distinction Task 8.3 D: Food Hunter
Instructions
In this task you are provided with the Ruby source code for a version of the Food Hunter program. You are required to extend that program to implement the changes specified below.
The following steps will guide you to complete this task.
1. Download the Ruby Food Hunter starter code from Doubtfire.
2. Make the changes as specified below to the provided foodhunter.rb code.
3. Save your code using the name: foodhuntermodified.rb.
4. Answer the Programming Principles questions on the provided Question/Answer sheet (see the Resources for this task).
Specification Changes:
1. Food objects that appears on the screen should randomly be selected to change direction.
When selected for changing direction the image for the food item should momentary display/flash the ‘smoke.png’ icon (see the media folder in the Resources) long enough for the user to briefly see it before the food item/object changes its movement to a random selected direction.
As the programmer you will need to experiment to determine what is an appropriate frequency of selection in relation to good game play.
Note: You will probably need to use the modulus operator (%) and the method: Gosu.milliseconds.
2. Add global constants SCREEN_HEIGHT and SCREEN_WIDTH, change the screen dimensions to 800 x 600. Make sure everything works as it should.
Page 2 of 3

Introduction to Programming Distinction Task 8.3 D: Food Hunter
Submission Requirements
For the Ruby Task:
Upload to Doubtfire:
1. Your foodhuntermodified.rb code.
2. Your screenshot of your code running. It should look something like the following:
3. Your answers to the question sheet.
End of Task.
Page 3 of 3