Commit ad37e17d authored by gem2578's avatar gem2578

Fixed render offset

parent 61dca42e
......@@ -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

3.29 KB | W: | H:

resource/field.png

3.31 KB | W: | H:

resource/field.png
resource/field.png
resource/field.png
resource/field.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -14,7 +14,7 @@ class Goal(pygame.sprite.Sprite):
self.rect.midright = [40, 250]
else:
self.rect.midleft = [761, 250]
self.rect.midleft = [760, 250]
self.mask = pygame.mask.from_surface(self.image)
......
......@@ -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 = (408,25)
self.rect.topleft = (405,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