Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
P
PythoCup
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bold Hearts
PythoCup
Commits
73379c55
Commit
73379c55
authored
Nov 24, 2018
by
Marcus M. Scheunemann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bug/collision' into 'master'
Fix collision See merge request
!2
parents
6460a0cd
d866f7ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
sprite/ball.py
sprite/ball.py
+1
-1
sprite/player.py
sprite/player.py
+1
-1
sprite/round_sprite.py
sprite/round_sprite.py
+5
-0
No files found.
sprite/ball.py
View file @
73379c55
...
...
@@ -46,7 +46,7 @@ class Ball_Sprite(rs.Round):
self
.
rect
.
move_ip
(
self
.
force
)
while
self
.
collide
():
back
=
(
self
.
force
*
-
1
).
normalize
()
self
.
rect
.
move_ip
(
back
)
self
.
rect
.
move_ip
(
self
.
round_vector2
(
back
)
)
self
.
force
=
pygame
.
math
.
Vector2
(
0
,
0
)
def
reset
(
self
):
...
...
sprite/player.py
View file @
73379c55
...
...
@@ -33,7 +33,7 @@ class Player(rs.Round):
self
.
rect
.
move_ip
(
move
)
while
self
.
collide
():
back
=
(
move
*
-
1
).
normalize
()
self
.
rect
.
move_ip
(
back
)
self
.
rect
.
move_ip
(
self
.
round_vector2
(
back
)
)
def
collide
(
self
):
for
player
in
self
.
self_team
:
...
...
sprite/round_sprite.py
View file @
73379c55
...
...
@@ -10,3 +10,8 @@ class Round(pygame.sprite.Sprite):
self
.
radius
=
int
(
diameter
/
2
)
pygame
.
draw
.
circle
(
self
.
image
,
colour
,
self
.
rect
.
center
,
self
.
radius
,
0
)
self
.
mask
=
pygame
.
mask
.
from_surface
(
self
.
image
)
def
round_vector2
(
self
,
vect
):
x
=
round
(
vect
[
0
])
y
=
round
(
vect
[
1
])
return
pygame
.
math
.
Vector2
(
x
,
y
)
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