Project Report 1
Project Report 1
Project Report 1
Group 26
STT Họ và Tên MSSV
26 Trần Quang Minh 20233971
35 Trần Sơn Tùng 20233986
Hà Nội, 10/2024
TABLE OF CONTENTS
TABLE OF CONTENTS..............................................................................................3
Chapter 1: Overview.....................................................................................................4
1.1. Introduction........................................................................................................4
CHAPTER 2: REQUIREMENTS...............................................................................8
4.2. Conclusion.........................................................................................................14
REFERENCES............................................................................................................16
Chapter 1: Overview
1.1. Introduction
A Catching Pokemon game is a type of game, typically aimed at children or casual
gamers, where the player’s objective is to catch pokemon in a virtual environment. The
game is often designed to be simple and entertaining, involving fun and colorful
graphics. The core mechanics of the game generally revolve around timing, reflexes, and
hand-eye coordination.
Pokemon catching games also help with rehabilitation a lot of benefits. For games
that involve using the hands or fingers to catch pokemon, it helps patients improve
dexterity and precision in small hand movements, which are crucial for everyday tasks.
1.3. Target
The player’s goal is to catch as many Pokemon as possible within a certain time
limit or until they reach a specific score.
Games that are popular for its simplicity and appeal to a wide range of players,
especially younger audiences or those looking for a relaxing experience.
The Catching Pokemon game is used in rehabilitation with the goal of aiding
patients' recovery by combining physical therapy exercises with a fun, interactive activity
Focus on Specific Abilities: While the game is designed to improve motor and
cognitive skills, it may not address all rehabilitation needs, such as emotional or social
aspects, unless integrated with broader therapy programs.
CHAPTER 2: REQUIREMENTS
User-Centric Design:
Engagement: The game should be engaging and motivating for users,
especially those undergoing long-term therapy.
Age Appropriateness: The design, visual style, and difficulty level
should cater to the target audience, which could be children, adults, or
elderly users.
Fun and Enjoyable: Rehabilitation can be tedious, so the game should
aim to reduce monotony through fun elements, such as interactive
environments or playful rewards (points, stars, or new levels).
Efficiency: The program should execute commands and queries
quickly to provide a smooth user experience.
Ease of Use: The game should have an intuitive interface that does not require a
lot of training or instructions and provide therapists with the ability to monitor progress
and customize game parameters according to the patient's needs.
Game Mechanics:
Pokemon Movement: Pokemon should follow dynamic, random, or
patterned paths that increase in difficulty as the player progresses,
requiring greater agility or precision.
Collision Detection: The game must accurately detect when the player
has “caught” a Pokemon (either through motion or touch).
Adaptive Difficulty: The game should adjust the challenge automatically
based on the player’s performance (e.g., if the player is struggling, make
butterflies slower; if progressing well, increase their speed).
User Feedback:
Immediate and progressive feedback on user performance.
Corrective prompts for movement errors or device issues.
Adaptive game difficulty and positive reinforcement based on
performance.
Visual, auditory, and potentially haptic feedback to enhance user
engagement.
CHAPTER 3: DESIGN AND CONTRUCTION PROCESS
Figure 3. 1: Timeline
The timeline for the Catching pokemon game in Python outlines the project's
development stages over several weeks.
In Weeks 4-5, the project begins with brainstorming ideas. During Weeks 6-7,
relevant references for the project are gathered. By Weeks 8-9, the necessary diagrams
are drawn, and initial coding and report slides are started.
Weeks 10-12 focus on fixing bugs, completing the basic functional code, and
testing features. Finally, in Weeks 12-18, the project is wrapped up with finishing the
report, finalizing slides, and coding any additional new features. This structured
approach ensures the project is systematically planned and executed.
I. Product demonstration
1. Pokémon with types and their GIFs
Purpose: defines a list of Pokémon, where each element is a dictionary containing
detailed information about each Pokémon.
Implementation:
name: Name of Pokémon.
gif: Path to a GIF file of the Pokémon. This GIF file contains frames that help
animate the Pokémon.
rarity: Pokémon rarity, which represents the probability of a Pokémon
appearing in the game. The higher the rarity value, the rarer and harder to find
the Pokémon.
type: The Pokémon's type (e.g. Land, Water, Flying), helps determine the area
in which it appears in the game.
points: The score the player receives when catching that Pokémon.
2. Zones of different Pokémon types
Purpose: Defines a dictionary named spawn_zones, which specifies the
coordinates for different Pokémon types to appear in the game
Implementation:
"Water": Represents the type of Pokémon that can appear in water areas.
"Land": Represents Pokémon that spawn on land.
"Flying": Represents Pokémon that appear in areas like trees or heights.
Purpose: Load a background image (GIF) and display it on the canvas, then
create an animation by changing between the frames (frames) of the GIF.
Implementation:
Command from PIL library to open GIF image file • Create a list containing
GIF image frames to create animation.
loop through each frame of the GIF and convert each frame to a format usable
on Tkinter.
From there, each frame is saved to self.background_frames, making it easy to
display each frame in order to create animation effect.
self.background_frame_index is initialized to 0, i.e. starting from the first
frame of the GIF.• The coordinate (0, 0) places the image at the top left
corner of the canvas.
ensures that the image is aligned from the top left corner.
The ID of this image is saved to self.background_image_id, making it easy to
change the next frame in the animation.
Finally, self.animate_background() is called to start the background animation
process by changing the displayed frame every certain amount of time,
animating the background.
3.4. Hàm self.score
Purpose: To initialize and display the player’s score at the top of the window.
Implementation:
Initializes the score variable to 0 at the start of the game, as the player
begins with no points.
Creates a Label widget in Tkinter to display the score.
The text parameter is set to show "Score: 0" initially. f"Score: {self.score}"
is used so that self.score can be dynamically updated as the game
progresses.
font=("Arial", 16) sets the font style and size.
Adds the score_label to the main window so that it’s visible to the player.
Purpose: allows the player to interact with the game by catching Pokémon,
which affects the score.
Implementation: To initialize the variable for the currently displayed Pokémon
and call the show_pokemon() function, which will select and display a
Pokémon on the screen.
4. Hàm animate_background(self)
Purpose: This function loops through the background GIF frames, creating a
continuous animated effect for the background.
Implementation:
Increments each time the function is called to cycle through the background
frames.
Updates the canvas with the current frame.
Sets a timer to call animate_background again every 100 milliseconds to create
a smooth looping animation.
5. Hàm show_pokemon(self)
Purpose: This function randomly selects and displays a Pokémon on the screen
with an animation, using Pokémon rarity to influence the selection.
Implementation:
Uses the rarity attribute of each Pokémon to choose one with weighted
probability.
loads the GIF of the selected Pokémon, and self.frames stores each frame for
animating the Pokémon.
Selects a spawn location based on Pokémon type, with a default location if no
specific type is found.
self.pokemon_image places the Pokémon on the canvas at a random spot within
the selected spawn area.
self.root.after(100, self.animate_pokemon) initiates the Pokémon's animation by
calling animate_pokemon every 100 milliseconds.
self.canvas.tag_bind(...) binds a click event to catch_pokemon, allowing the
player to "catch" the Pokémon by clicking on it.
6. Hàm animate_pokemon(self)
Purpose: Similar to animate_background, this function animates the selected
Pokémon by cycling through its GIF frames.
Implementation:
self.frame_index increments each time to show the next frame of the Pokémon
GIF.
self.canvas.itemconfig(self.pokemon_image,
image=self.frames[self.frame_index]) updates the canvas image to the current
frame.
self.root.after(100, self.animate_pokemon) re-calls animate_pokemon every
100 milliseconds to loop through the GIF frames.
Purpose: This function handles the logic when a player clicks on a Pokémon,
updating the score and spawning a new Pokémon.
Implementation:
Purpose:
The code creates the visual interface where users will interact with the
game.
root = tk.Tk() :This line initializes the main application window by creating an
instance of the Tk class. This instance (root) serves as the primary window for
your application where all the UI components, such as the canvas, buttons, and
labels, will be displayed.
game = PokemonGame(root): This initialization triggers the __init__ method in
the PokemonGame class, which sets up the game’s user interface, initializes the
game state, and begins the background animation and Pokémon display.
root.mainloop(): In the context of the Pokémon game, this loop allows
animations to continue running (like the moving background and the Pokémon
animations) and processes user interactions (like catching Pokémon).
II. Conclusion