Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Abdi Danny 2019 ZHAC232 100938755 FINAL YEAR PROJECT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Abdi Danny (2019) ZHAC232
Abdi Danny 2019 ZHAC232 100938755 FINAL YEAR PROJECT
Commits
ec916624
Commit
ec916624
authored
1 year ago
by
DannyAbdi
Browse files
Options
Downloads
Patches
Plain Diff
reformated code
parent
0b35de75
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
Single and Multi-Agent Pathfinding in Maze games
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
enemy.py
+5
-0
5 additions, 0 deletions
enemy.py
with
5 additions
and
0 deletions
enemy.py
+
5
−
0
View file @
ec916624
...
...
@@ -4,6 +4,8 @@ from config import *
"""
Class representing an enemy agent in the game.
"""
class
Enemy
:
"""
Initialise the Enemy object.
...
...
@@ -12,6 +14,7 @@ class Enemy:
:param x (int): The x-coordinate of the enemy
'
s position.
:param y (int): The y-coordinate of the enemy
'
s position.
"""
def
__init__
(
self
,
maze
):
self
.
maze
=
maze
self
.
x
,
self
.
y
=
self
.
reset_position
()
...
...
@@ -21,6 +24,7 @@ class Enemy:
:return: tuple: A tuple containing the x and y coordinates of the enemy
'
s position.
"""
def
reset_position
(
self
):
while
True
:
num_rows
=
self
.
maze
.
num_rows
()
...
...
@@ -41,5 +45,6 @@ class Enemy:
:param screen: The Pygame screen surface to draw on.
"""
def
draw
(
self
,
screen
):
pygame
.
draw
.
rect
(
screen
,
'
blue
'
,
(
self
.
x
,
self
.
y
,
TILE_SIZE
,
TILE_SIZE
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment