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
1306c5a2
Commit
1306c5a2
authored
Nov 25, 2018
by
Marcus M. Scheunemann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bug/render-off-by-one' into 'master'
Fixed render offset See merge request
!4
parents
61dca42e
ad37e17d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
11 deletions
+30
-11
resource/create/render_resources.py
resource/create/render_resources.py
+26
-8
resource/field.png
resource/field.png
+0
-0
sprite/goal.py
sprite/goal.py
+1
-1
sprite/score.py
sprite/score.py
+3
-2
No files found.
resource/create/render_resources.py
View file @
1306c5a2
...
...
@@ -5,10 +5,18 @@ GREEN = (34,198,38)
YELLOW
=
(
222
,
220
,
47
)
goal_size
=
(
40
,
144
)
size
=
np
.
array
([
800
,
500
])
center
=
size
/
2
one
=
np
.
array
([
1
,
1
])
field_img_size
=
np
.
array
([
800
,
500
])
size
=
field_img_size
-
one
circle_offset
=
np
.
array
([
40
,
40
])
line_offset
=
np
.
array
([
400
,
25
])
center_UL
=
np
.
floor
(
size
/
2
)
center_LL
=
center_UL
+
np
.
array
([
0
,
1
])
center_UR
=
center_UL
+
np
.
array
([
1
,
0
])
center_LR
=
center_UL
+
one
line_offset
=
np
.
array
([
center_UL
[
0
],
25
])
corner_offset
=
np
.
array
([
20
,
20
])
corner_UL
=
np
.
array
([
40
,
25
])
corner_LR
=
size
-
corner_UL
...
...
@@ -16,20 +24,30 @@ corner_LL = np.array([corner_LR[0] ,corner_UL[1]])
corner_UR
=
np
.
array
([
corner_UL
[
0
]
,
corner_LR
[
1
]])
inner_goal_UL
=
np
.
array
([
40
,
160
])
inner_goal_LR
=
np
.
array
([
120
,(
500
-
160
)])
inner_goal_LR
=
np
.
array
([
(
inner_goal_UL
[
0
]
+
80
),(
size
[
1
]
-
inner_goal_UL
[
1
]
)])
outer_goal_UL
=
np
.
array
([
40
,
90
])
outer_goal_LR
=
np
.
array
([
180
,(
500
-
90
)])
outer_goal_LR
=
np
.
array
([
(
outer_goal_UL
[
0
]
+
140
),(
size
[
1
]
-
outer_goal_UL
[
1
]
)])
field_img
=
Image
.
new
(
"RGB"
,
tuple
(
size
),
GREEN
)
field_img
=
Image
.
new
(
"RGB"
,
tuple
(
field_img_
size
),
GREEN
)
draw
=
ImageDraw
.
Draw
(
field_img
)
field_area
=
(
tuple
(
corner_UL
),
tuple
(
corner_LR
))
draw
.
rectangle
(
field_area
,
outline
=
"white"
,
width
=
2
)
center_circle
=
(
tuple
(
center
-
circle_offset
),
tuple
(
center
+
circle_offset
))
draw
.
ellipse
(
center_circle
,
outline
=
"white"
,
width
=
2
)
center_circle_UL
=
(
tuple
(
center_UL
-
circle_offset
),
tuple
(
center_UL
+
circle_offset
))
draw
.
arc
(
center_circle_UL
,
179
,
271
,
fill
=
"white"
,
width
=
2
)
center_circle_LL
=
(
tuple
(
center_LL
-
circle_offset
),
tuple
(
center_LL
+
circle_offset
))
draw
.
arc
(
center_circle_LL
,
89
,
181
,
fill
=
"white"
,
width
=
2
)
center_circle_UR
=
(
tuple
(
center_UR
-
circle_offset
),
tuple
(
center_UR
+
circle_offset
))
draw
.
arc
(
center_circle_UR
,
269
,
1
,
fill
=
"white"
,
width
=
2
)
center_circle_LR
=
(
tuple
(
center_LR
-
circle_offset
),
tuple
(
center_LR
+
circle_offset
))
draw
.
arc
(
center_circle_LR
,
359
,
91
,
fill
=
"white"
,
width
=
2
)
left_inner_goal_area
=
(
tuple
(
inner_goal_UL
),
tuple
(
inner_goal_LR
))
draw
.
rectangle
(
left_inner_goal_area
,
outline
=
"white"
,
width
=
2
)
...
...
resource/field.png
View replaced file @
61dca42e
View file @
1306c5a2
3.29 KB
|
W:
|
H:
3.31 KB
|
W:
|
H:
2-up
Swipe
Onion skin
sprite/goal.py
View file @
1306c5a2
...
...
@@ -14,7 +14,7 @@ class Goal(pygame.sprite.Sprite):
self
.
rect
.
midright
=
[
40
,
250
]
else
:
self
.
rect
.
midleft
=
[
76
1
,
250
]
self
.
rect
.
midleft
=
[
76
0
,
250
]
self
.
mask
=
pygame
.
mask
.
from_surface
(
self
.
image
)
...
...
sprite/score.py
View file @
1306c5a2
...
...
@@ -16,12 +16,13 @@ class Score(pygame.sprite.Sprite):
self
.
render
()
def
render
(
self
):
self
.
image
=
self
.
font
.
render
(
str
(
self
.
score
),
0
,
(
0
,
0
,
0
))
text
=
str
(
self
.
score
).
zfill
(
2
)
self
.
image
=
self
.
font
.
render
(
text
,
0
,
(
0
,
0
,
0
),
(
200
,
200
,
200
))
self
.
rect
=
self
.
image
.
get_rect
()
if
self
.
side
==
Side
.
LEFT
:
self
.
rect
.
topright
=
(
395
,
25
)
else
:
self
.
rect
.
topleft
=
(
40
8
,
25
)
self
.
rect
.
topleft
=
(
40
5
,
25
)
def
increase
(
self
):
self
.
score
+=
1
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