Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GamesDevGame
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
christopher.spray
GamesDevGame
Commits
a94fec03
Commit
a94fec03
authored
Apr 30, 2020
by
christopher.spray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final
parent
e095d4b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
bandit.cpython-36.pyc
__pycache__/bandit.cpython-36.pyc
+0
-0
bandit.py
bandit.py
+8
-3
No files found.
__pycache__/bandit.cpython-36.pyc
View file @
a94fec03
No preview for this file type
bandit.py
View file @
a94fec03
import
pygame
import
math
import
time
from
random
import
randint
#Might need to change spawning area when implementing wall collision
...
...
@@ -26,6 +27,8 @@ class Bandit(pygame.sprite.Sprite):
self
.
spriteGroupWall
=
spriteGroupWall
self
.
enemiesOnScreen
=
enemiesOnScreen
self
.
stopped
=
False
self
.
stoppedTime
=
0
self
.
stopWaitLength
=
0.01
if
(
self
.
spawnZone
==
1
):
#1 top = (300,0) - (500,50)
...
...
@@ -60,11 +63,13 @@ class Bandit(pygame.sprite.Sprite):
xDiff
=
self
.
rect
.
x
-
otherBandit
.
rect
.
x
yDiff
=
self
.
rect
.
y
-
otherBandit
.
rect
.
y
totalDiff
=
math
.
hypot
(
xDiff
,
yDiff
)
#get Euclidian diff in coords
if
totalDiff
<
self
.
rect
.
width
and
otherBandit
.
playerDist
()
<
self
.
playerDist
()
and
not
self
.
stopped
:
if
totalDiff
<
self
.
rect
.
width
and
otherBandit
.
playerDist
()
<
self
.
playerDist
():
self
.
stopped
=
True
self
.
stoppedTimer
=
time
.
time
()
print
(
"STOPPED"
)
else
:
self
.
stopped
=
False
if
self
.
stopped
and
time
.
time
()
>
self
.
stoppedTimer
+
self
.
stopWaitLength
:
self
.
stopped
=
False
if
not
self
.
stopped
:
try
:
#try this block
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment