Commit d6508c00 authored by gem2578's avatar gem2578

Update to resourecs

parent 73379c55
# Python Cup Resource Creation
This is a small python script to generate the field and goal images
## Prerequirements
- Python 3
- Numpy 1.15.4
- Pillow 5.3.0
## Install
If you already have Python Cup all you need to do is install the packages with one of the two commands
- `pip3 install -r requirements.txt`
- `python3 -m pip install -r requirements.txt`
# Contribution
You're welcome to contribute. Please have a look at [Gitlab's workflow](https://docs.gitlab.com/ee/workflow/forking_workflow.html) first. It is helpful if each commit addresses a specific feature before requesting a merge. You can achieve this with, e.g., squashing the commits of your working copy.
from PIL import Image, ImageDraw
import numpy as np
GREEN = (34,198,38)
YELLOW = (222, 220, 47)
goal_size = (40,144)
size = np.array([800,500])
center = size / 2
circle_offset = np.array([40,40])
line_offset = np.array([400,25])
corner_offset = np.array([20,20])
corner_UL = np.array([40,25])
corner_LR = size - corner_UL
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)])
outer_goal_UL = np.array([40,90])
outer_goal_LR = np.array([180,(500-90)])
field_img = Image.new("RGB", tuple(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)
left_inner_goal_area = (tuple(inner_goal_UL),tuple(inner_goal_LR))
draw.rectangle(left_inner_goal_area, outline="white", width=2)
right_inner_goal_area = (tuple(size - inner_goal_LR),tuple(size - inner_goal_UL))
draw.rectangle(right_inner_goal_area, outline="white", width=2)
left_outer_goal_area = (tuple(outer_goal_UL),tuple(outer_goal_LR))
draw.rectangle(left_outer_goal_area, outline="white", width=2)
right_outer_goal_area = (tuple(size - outer_goal_LR),tuple(size - outer_goal_UL))
draw.rectangle(right_outer_goal_area, outline="white", width=2)
line_area = (tuple(line_offset),tuple(size - line_offset))
draw.rectangle(line_area, outline="white", width=2)
corner_UL_area = (tuple(corner_UL - corner_offset),tuple(corner_UL + corner_offset))
draw.arc(corner_UL_area, 0, 90, fill="white", width=2)
corner_LR_area = (tuple(corner_LR - corner_offset),tuple(corner_LR + corner_offset))
draw.arc(corner_LR_area, 180, 270, fill="white", width=2)
corner_UR_area = (tuple(corner_UR - corner_offset),tuple(corner_UR + corner_offset))
draw.arc(corner_UR_area, 270, 0, fill="white", width=2)
corner_LL_area = (tuple(corner_LL - corner_offset),tuple(corner_LL + corner_offset))
draw.arc(corner_LL_area, 90, 180, fill="white", width=2)
field_img.save("../field.png", "PNG")
Image.new("RGB", goal_size , YELLOW).save("../goal.png", "PNG")
numpy>=1.15.4
pillow>=5.3.0
resource/field.png

2.76 KB | W: | H:

resource/field.png

3.29 KB | W: | H:

resource/field.png
resource/field.png
resource/field.png
resource/field.png
  • 2-up
  • Swipe
  • Onion skin
resource/goal.png

236 Bytes | W: | H:

resource/goal.png

150 Bytes | W: | H:

resource/goal.png
resource/goal.png
resource/goal.png
resource/goal.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -19,9 +19,9 @@ class Score(pygame.sprite.Sprite):
self.image = self.font.render(str(self.score), 0, (0,0,0))
self.rect = self.image.get_rect()
if self.side == Side.LEFT:
self.rect.topright = (399,25)
self.rect.topright = (395,25)
else:
self.rect.topleft = (405,25)
self.rect.topleft = (408,25)
def increase(self):
self.score += 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment