Browse Source

Wrote an SVG for the bubbler tower

master
Elis Axelsson 4 years ago
parent
commit
1649e7058b
  1. 17
      classes/towers/bubbler.py
  2. 10
      images/bubbler.svg

17
classes/towers/bubbler.py

@ -1,4 +1,5 @@
import pygame
from classes.svg import Svg
from classes.towers.tower import Tower
from classes.settings import Settings
from classes.towers.projectiles.bubble import Bubble
@ -8,19 +9,11 @@ class Bubbler(Tower):
def __init__(self, gridPos):
settings = Settings()
# Make a surface
surface = pygame.Surface(
(settings.gridSize, settings.gridSize),
pygame.SRCALPHA
)
# Convert SVG to PNG and return filename
pngFile = Svg().svgAsPng('images/bubbler.svg', (10, 10))
# And fill it with a square the same size.
pygame.draw.rect(
surface,
(0, 0, 255),
surface.get_rect(),
0
)
# Import bubble image
surface = pygame.image.load(pngFile)
# Call the generic Tower constructor
super(self.__class__, self).__init__(

10
images/bubbler.svg

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60">
<g class="bubbler-body">
<rect fill="#000000" width="52" height="52" x="4" y="4" />
<rect fill="#7777FF" width="50" height="50" x="5" y="5" />
</g>
<g class="bubbler-gun">
<rect fill="#000000" width="12" height="12" x="24" y="24" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 330 B

Loading…
Cancel
Save