Commit e4558ecc authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Updated the codebase for the 2019 assignment.

parent 998d9f5b
This diff is collapsed.
......@@ -36,7 +36,7 @@ version = 1.0
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = kivy
requirements = python3,kivy
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
......@@ -88,16 +88,16 @@ fullscreen = 0
#android.permissions = INTERNET
# (int) Android API to use
#android.api = 19
android.api = 21
# (int) Minimum API required
#android.minapi = 9
android.minapi = 21
# (int) Android SDK version to use
#android.sdk = 20
# (str) Android NDK version to use
#android.ndk = 9c
android.ndk = 17c
# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True
......@@ -146,8 +146,11 @@ fullscreen = 0
# bootstrap)
#android.gradle_dependencies =
# (list) Java classes to add as activities to the manifest.
#android.add_activites = com.example.ExampleActivity
# (str) python-for-android branch to use, defaults to stable
#p4a.branch = stable
p4a.branch = master
# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
......@@ -159,6 +162,9 @@ fullscreen = 0
# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =
# (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard
# (list) Android additional libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
......@@ -201,6 +207,9 @@ android.arch = armeabi-v7a
# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2
# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask)
#p4a.port =
#
# iOS specific
......@@ -220,7 +229,7 @@ android.arch = armeabi-v7a
[buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2
log_level = 1
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1
......
The enum package was introduced in Python 3.4 and backported to earlier
versions. While most Python distributions nowadays include that backport, the
distribution Kivy uses on Android does not, so we must provide our own copy of
the backport.
This diff is collapsed.
This diff is collapsed.
#:import Game main.Game
#:import UnitType ants_vs_some_bees.UnitType
#:set SPRITE_SIZE (Game.SPRITE_WIDTH, Game.SPRITE_HEIGHT)
#:set UNIT_NAMES {UnitType.HARVESTER: 'Harvester Ant', UnitType.SHORT_THROWER: 'Short-Range Leaf Thrower', UnitType.THROWER: 'All-Range Leaf Thrower', UnitType.LONG_THROWER: 'Long-Range Leaf Thrower', UnitType.WALL: 'Wall Ant'}
#:set UNIT_NAMES {UnitType.HARVESTER: 'Harvester Ant', UnitType.THROWER: 'Leaf Thrower'}
ScreenManager:
Screen:
name: 'ready'
canvas.before:
Color:
rgba: (1, 1, 1, 1)
rgba: (1.0, 1.0, 1.0, 1.0)
Rectangle:
pos: self.pos
size: self.size
......@@ -23,7 +23,7 @@ ScreenManager:
Label:
text: 'vs.'
font_size: sp(24)
color: (0, 0, 0, 1)
color: (0.0, 0.0, 0.0, 1.0)
Image:
source: 'assets/bee.gif'
Widget:
......@@ -31,13 +31,13 @@ ScreenManager:
Label:
text: 'Ants vs. Some Bees'
font_size: sp(48)
color: (0, 0, 0, 1)
color: (0.0, 0.0, 0.0, 1.0)
size_hint: (1, None)
size: self.texture_size
Label:
text: 'A Tower-Defense Game'
font_size: sp(24)
color: (0, 0, 0, 1)
color: (0.0, 0.0, 0.0, 1.0)
size_hint: (1, None)
size: self.texture_size
Widget:
......@@ -57,7 +57,7 @@ ScreenManager:
name: 'instructions'
canvas.before:
Color:
rgba: (1, 1, 1, 1)
rgba: (1.0, 1.0, 1.0, 1.0)
Rectangle:
pos: self.pos
size: self.size
......@@ -80,197 +80,31 @@ ScreenManager:
font_size: sp(36)
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
Label:
color: (0.0, 0.0, 0.0, 1.0)
Paragraph:
id: first_paragraph
text: 'In "Ants vs. Some Bees" you deploy different kinds of ants to defend a queen ant from waves of attacking bees.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
Label:
Paragraph:
text: 'A game consists of a series of turns. In each turn the ants act first, producing resources for the colony or attacking incoming bees by throwing leaves at them. Then the bees act, either advancing on the queen or stinging ants in their way. The game ends either when a bee reaches the ant queen (you lose), or the entire bee flotilla has been vanquished (you win).'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
Label:
Paragraph:
text: 'The interface is divided into three parts. The queen ant, colony, and attacking bees appear in the battlefield view at the bottom of the screen; if the battlefield is bigger than your screen, you can drag the view around. Above the battlefield is a status bar that shows the tool you currently have selected, the number of turns elapsed since the start of the game, and the amount of food your colony has to spend on new ants. At the very top is a toolbar where you can select different kinds of ants to place or else the tool to sacrifice ants. The toolbar will also scroll if it does not fit on your screen.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
Label:
text: 'To deploy an ant, select the type you want in the toolbar and tap on the place in a tunnel where you want it. The only restrictions on ant placement are: 1) you cannot deploy an ant to a space that another insect is occupying or entering and 2) you cannot deploy an ant if you do not have enough food to pay for it; the status bar will show how much an ant type costs when you have it selected.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
Label:
Paragraph:
text: 'To deploy an ant, select the type you want in the toolbar and tap on the place in a tunnel where you want it. The only restrictions on ant placement are: 1) you cannot deploy an ant to a space that another insect is occupying or entering and 2) you cannot deploy an ant if you do not have enough food to pay for it. The status bar will show how much an ant type costs when you have it selected.'
Paragraph:
text: 'The following ant types are available:'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: harvester_image.height
Image:
id: harvester_image
CaptionedSprite:
source: 'assets/ant_harvester.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'A harvester ant costs 3 food units to deploy, but produces 2 food units per turn.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: harvester_image.height
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: short_thrower_image.height
Image:
id: short_thrower_image
source: 'assets/ant_short_thrower.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'A short-range leaf thrower costs 3 food units to deploy and can throw leaves at bees it sees up to two spaces away.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: short_thrower_image.height
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: thrower_image.height
Image:
id: thrower_image
source: 'assets/ant_thrower.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'An all-range thrower costs 7 food units to deploy and can throw leaves at any range.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: thrower_image.height
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: long_thrower_image.height
Image:
id: long_thrower_image
source: 'assets/ant_long_thrower.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'A long-range thrower costs 3 food units to deploy and can throw leaves at bees it sees from at least four spaces away.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: long_thrower_image.height
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: wall_image.height
Image:
id: wall_image
source: 'assets/ant_wall.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'A wall ant costs 4 food units to deploy and has no attack, but it can withstand 4 stings before dying.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: wall_image.height
color: (0, 0, 0, 1)
Label:
text: 'A harvester ant costs 3 food units to deploy, but produces 1 unit of food per turn.'
CaptionedSprite:
source: 'assets/ant_medium.gif'
text: 'An leaf thrower costs 7 food units to deploy and dies after throwing four leaves. It will only throw leaves outward, away from the queen.'
Paragraph:
text: 'To sacrifice an ant, which can be useful if you need space for new deployments, select the sacrifice tool and tap on the ant you want to sacrifice.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
Label:
Paragraph:
text: 'Bees, unlike ants, come in only one form:'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: wall_image.height
Image:
id: wall_image
CaptionedSprite:
source: 'assets/bee.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'A bee can either fly forward or sting each turn. It normally takes 4 leaves to kill a bee.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: wall_image.height
color: (0, 0, 0, 1)
Label:
text: 'However, bees get certain advantages from the terrain:'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: self.texture_size[1] + 24
color: (0, 0, 0, 1)
BoxLayout:
orientation: 'horizontal'
size_hint: (1, None)
height: wall_image.height
Image:
id: wall_image
canvas.before:
Color:
rgba: (1, 0.5, 0.5, 1)
Rectangle:
pos: self.pos
size: self.size
source: 'assets/tunnel.gif'
size_hint: (None, 1)
size: SPRITE_SIZE
Label:
text: 'Every time a bee reaches a red-shaded space in the tunnel, its health increases by one point.'
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
height: wall_image.height
color: (0, 0, 0, 1)
text: 'A bee can either fly forward or sting each turn. It normally takes 4 hits to kill a bee.'
Button:
text: 'Back'
font_size: sp(36)
......@@ -283,8 +117,34 @@ ScreenManager:
size_hint: (None, 1)
width: sp(24)
Screen:
name: 'go'
id: go
name: 'game'
id: game_screen
<Text>:
text_size: (self.width, None)
halign: 'justify'
valign: 'middle'
size_hint: (1, None)
color: (0.0, 0.0, 0.0, 1.0)
<Paragraph>:
height: self.texture_size[1] + 24
<CaptionedSprite>:
orientation: 'horizontal'
size_hint: (1, None)
height: image.height
Image:
id: image
source: root.source
size_hint: (None, 1)
size: SPRITE_SIZE
Text:
text: root.text
height: image.height
<Game>:
......@@ -299,7 +159,7 @@ ScreenManager:
size: (max(ant_menu_scroll.width, ant_menu.width), max(ant_menu_scroll.height, ant_menu.height))
canvas.before:
Color:
rgba: (1, 1, 1, 1)
rgba: (1.0, 1.0, 1.0, 1.0)
Rectangle:
pos: self.pos
size: self.size
......@@ -331,26 +191,20 @@ ScreenManager:
height: 24
ScrollView:
id: field_scroll
AnchorLayout:
size_hint: (None, None)
size: (max(field_scroll.width, field.width), max(field_scroll.height, field.height))
canvas.before:
Color:
rgba: (1, 1, 1, 1)
rgba: (0.4, 1.0, 0.6, 1.0)
Rectangle:
pos: self.pos
size: self.size
AnchorLayout:
size_hint: (None, None)
size: (max(field_scroll.width, field.width), max(field_scroll.height, field.height))
RelativeLayout:
id: field
size_hint: (None, None)
anchor_x: 'center'
anchor_y: 'center'
canvas.before:
Color:
rgba: (1, 1, 1, 1)
Rectangle:
pos: self.pos
size: self.size
<ImageToggleButton>:
......@@ -365,12 +219,6 @@ ScreenManager:
<Sprite>:
canvas.before:
Color:
rgba: self.background_color
Rectangle:
pos: self.pos
size: self.size
pos: (Game.SPRITE_WIDTH * self.world_x, Game.SPRITE_HEIGHT * self.world_y)
pos: (Game.SPRITE_WIDTH * (self.world_x + (1 - self.scale) / 2), Game.SPRITE_HEIGHT * (self.world_y + (1 - self.scale) / 2))
size_hint: (None, None)
size: SPRITE_SIZE
size: (Game.SPRITE_WIDTH * self.scale, Game.SPRITE_HEIGHT * self.scale)
Supports Markdown
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