Added a simple title screen.
Justin Armstrong justinmeister@gmail.com
Fri, 30 May 2014 10:16:19 -0700
7 files changed,
119 insertions(+),
32 deletions(-)
M
data/constants.py
→
data/constants.py
@@ -82,4 +82,10 @@ FIRE = 'fire'
PUNCH = 'punch' POWERUP = 'powerup' -TRANSITION_SPEED = 25 +TRANSITION_SPEED = 35 + +#LEVEL STATES + +NORMAL = 'normal' +TRANSITION_IN = 'transition in' +TRANSITION_OUT = 'transition out'
M
data/main.py
→
data/main.py
@@ -1,5 +1,4 @@
-from data.states.main_menu import main_menu -from data.states import shop, levels, battle +from data.states import shop, levels, battle, main_menu from . import setup, tools from . import constants as c
D
data/states/main_menu/main_menu.py
@@ -1,28 +0,0 @@
-import pygame as pg -from ... import setup, tools -from ... import constants as c - -class Menu(tools._State): - def __init__(self): - super(Menu, self).__init__() - self.next = c.OVERWORLD - self.surface = setup.SCREEN - self.rect = self.surface.get_rect() - text = 'Arrows for navigation, space for input, Enter/Return for menu' - self.font = pg.font.Font(setup.FONTS[c.MAIN_FONT], 22) - self.rendered_text = self.font.render(text, 1, c.BLACK) - self.text_rect = self.rendered_text.get_rect() - self.text_rect.center = self.rect.center - self.game_data = tools.create_game_data_dict() - self.name = c.MAIN_MENU - - - def update(self, surface, keys, current_time): - self.current_time = current_time - surface.fill(c.WHITE) - surface.blit(self.rendered_text, self.text_rect) - - def get_event(self, event): - if event.type == pg.KEYDOWN: - self.game_data['last state'] = self.name - self.done = True
A
resources/tmx/title.tmx
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?> +<map version="1.0" orientation="orthogonal" width="25" height="19" tilewidth="16" tileheight="16"> + <tileset firstgid="1" name="tileset2" tilewidth="16" tileheight="16"> + <image source="../graphics/tileset2.png" width="160" height="180"/> + </tileset> + <tileset firstgid="111" name="tileset1" tilewidth="16" tileheight="16"> + <image source="../graphics/tileset1.png" width="160" height="80"/> + </tileset> + <layer name="Tile Layer 1" width="25" height="19"> + <data encoding="base64" compression="zlib"> + eJyTZGBgkBzFo3gUj+JRPIpHMc0wAJGoLmQ= + </data> + </layer> + <layer name="Tile Layer 2" width="25" height="19"> + <data encoding="base64" compression="zlib"> + eJy1kzsOwDAMQrn/yOzDdqklhNypgBTFyvDwLwBA9MT3TNFnhD8FPuVu1aH5p+u48k/3ybmNPl15p32Wv3v75ftXy/S5p/kap+tYZnvu2ifKW1o+kxZf40avaHFrty6flC5m84+4d0rKegD8hDUX + </data> + </layer> +</map>