Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mics updates, lots of new bugs :(

  • Loading branch information...
commit 1c0fdd02c473e26b75c758ac750d428b060bc670 1 parent ffb76f3
@bitcraft authored
View
6 CREDITS.rtf
@@ -25,4 +25,8 @@ explosions\
http://opengameart.org/content/explosion-animations\
explosion animations\
jetrel\
-}
+\
+\
+tree.png\
+http://opengameart.org/content/gnarled-tree\
+geloescht}
View
165 buildworld.py
@@ -1,165 +0,0 @@
-from lib2d.area import AbstractArea, Area
-from lib2d.buildarea import fromTMX
-from lib2d.avatar import Avatar, Animation, StaticAnimation
-from lib2d.objects import AvatarObject
-from lib.hero import Hero
-from lib.level import Level
-from lib.enemies import *
-from lib.misc import *
-from lib2d import res
-
-from collections import defaultdict
-import os
-
-
-
-# build the initial environment
-uni = Area()
-uni.name = 'MH'
-uni.setGUID(0)
-
-
-# build our avatars and heros
-avatar = Avatar()
-ani = Animation("hero-idle.png", "stand", 9, 1, 100)
-avatar.add(ani)
-ani = Animation("hero-walk.png", "walk", 10, 1, 100)
-avatar.add(ani)
-ani = Animation("hero-crouch.png", "crouch", 5, 1, 30)
-avatar.add(ani)
-ani = Animation("hero-uncrouch.png", "uncrouch", 5, 1, 30)
-avatar.add(ani)
-ani = Animation("hero-brake.png", "brake", 6, 1, 30)
-avatar.add(ani)
-ani = Animation("hero-run.png", "run", 16, 1, 30)
-avatar.add(ani)
-ani = Animation("hero-sprint.png", "sprint", 17, 1, 100)
-avatar.add(ani)
-ani = Animation("hero-wait.png", "wait", 6, 1, 100)
-avatar.add(ani)
-ani = Animation("hero-jump.png", "jump", 4, 1, 20)
-avatar.add(ani)
-ani = Animation("hero-die.png", "die", 3, 1, 85)
-avatar.add(ani)
-avatar.play("stand")
-npc = Hero()
-npc.setName("Doc")
-npc.setAvatar(avatar)
-npc.setGUID(1)
-npc.size = (4, 16, 32)
-npc.avatar.axis = (-7,0)
-uni.add(npc)
-
-
-# laser robot
-avatar = Avatar()
-ani = StaticAnimation("robot-stand.png", "stand")
-avatar.add(ani)
-ani = Animation("robot-shoot.png", "warn", 4, 1, 60)
-avatar.add(ani)
-ani = Animation("robot-shoot.png", "shoot", 4, 1, 30)
-avatar.add(ani)
-npc = LaserRobot()
-npc.setName("LaserRobot")
-npc.setAvatar(avatar)
-npc.setGUID(513)
-npc.size = (4, 14, 30)
-npc.avatar.axis = (-9,-2)
-uni.add(npc)
-
-
-# lifts
-avatar = Avatar()
-ani = StaticAnimation("lift-idle.png", "idle")
-avatar.add(ani)
-ani = Animation("lift-glow.png", "glow", 4, 1, 100)
-avatar.add(ani)
-npc = Lift()
-npc.setName("Lift")
-npc.setAvatar(avatar)
-npc.setGUID(769)
-npc.size = (4, 32, 16)
-npc.avatar.axis = (0,16)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(770)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(771)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(772)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(773)
-uni.add(npc)
-
-
-#lift buttons
-avatar = Avatar()
-ani = StaticAnimation("button2.png", "off")
-avatar.add(ani)
-ani = StaticAnimation("button1.png", "on")
-avatar.add(ani)
-npc = Callbutton()
-npc.setName("Callbutton")
-npc.setAvatar(avatar)
-npc.setGUID(257)
-npc.size = (4, 16, 32)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(258)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(259)
-uni.add(npc)
-
-npc = npc.copy()
-npc.setGUID(260)
-uni.add(npc)
-
-
-# load the avatar objects and set their world size based off the first frame
-# of their default animations
-#import pygame, time
-
-#pygame.init()
-#screen = pygame.display.set_mode((240, 480))
-#pygame.display.set_caption('Image Loading...')
-
-#for ao in [ i for i in uni.getChildren() if isinstance(i, AvatarObject) ]:
-# [ i.load() for i in ao.avatar.getChildren() ]
-# sx, sy = ao.avatar.default.getImage(0).get_size()
-# x, y, z, d, w, h = ao.parent.getBBox(ao)
-# ao.parent.setBBox(ao, (x, y, z, 4, sx, sy))
-# [ i.unload() for i in ao.avatar.getChildren() ]
-
-
-
-
-# always load the levels last since they may duplicate objects
-level = fromTMX(uni, "level1.tmx")
-level.setName("Level 1")
-level.setGUID(1001)
-
-
-#haccckk
-for lift in [ i for i in uni.getChildren() if isinstance(i, Lift) ]:
- body = lift.parent.getBody(lift)
- body.bbox = body.bbox.move(0,0,1)
-
-
-# move buttons back so they don't collide with stuff
-for button in [ i for i in uni.getChildren() if isinstance(i, Callbutton) ]:
- body = lift.parent.getBody(button)
- body.bbox = body.bbox.move(4,0,1)
-
-
-uni.save(os.path.join("resources", "worlds", "world"))
-#pygame.quit()
View
4 lib/enemies.py
@@ -14,7 +14,6 @@ def update(self, time):
self.time += time
if self.time >= self.ttl:
self.destroy()
- pass
def draw(self, surface):
surface.fill((255,randint(0,255),255))
@@ -29,9 +28,12 @@ def __init__(self):
self.time = 0
self.warned = False
self.pushable = True
+ self.active = True
def update(self, time):
+ if not self.active: return
+
self.time += time
if self.time >= self.rate:
self.time -= self.rate
View
72 lib/levelstate.py
@@ -42,6 +42,11 @@ def play(self, filename, volume=1.0):
SoundMan = SoundManager()
+# GLOBAL LEET SKILLS
+heroBody = None
+
+
+
class LevelState(GameState):
"""
This state is where the player will move the hero around the map
@@ -63,13 +68,6 @@ class LevelState(GameState):
contains metadata that lib2d can use to layout and position objects
correctly.
- i would really like the game to be sandboxable...set traps,
- make contraptions, etc
-
- controls:
- picking up objects will affect what your buttons do
- equipted items always have a dedicated button
- should have hot-swap button and drop button
"""
def __init__(self, area, startPosition=None):
@@ -78,6 +76,8 @@ def __init__(self, area, startPosition=None):
def activate(self):
+ global hero_body
+
self.blank = True
self.background = (109, 109, 109)
self.foreground = (0, 0, 0)
@@ -88,11 +88,17 @@ def activate(self):
self.player_vector = (0,0,0)
self.old_player_vector = (0,0,0)
self.old_falling = None
- self.hero_jump = 35
+ self.hero_jump = 25
+
+ self.camera = None
# allow the area to get needed data
self.area.load()
+ # load the children
+ for child in self.area.getChildren():
+ child.load()
+
# get the root and the hero from it
root = self.area.getRoot()
self.hero = root.getChildByGUID(1)
@@ -102,16 +108,7 @@ def activate(self):
if not self.area.hasChild(self.hero):
self.area.add(self.hero)
- # attach a camera
- sw, sh = sd.get_size()
- mw = sw * .75
- mh = sh * .75
- self.camera = LevelCamera(self.area,((4,4), (mw, mh)),
- tmxdata=self.area.tmxdata)
-
- self.mapBorder = pygame.Rect((0,0,mw+6,mh+6))
- self.msgBorder = pygame.Rect((0,mh,sw,sh-mh))
- self.hudBorder = pygame.Rect((mw,0,sw-mw,mh+6))
+ hero_body = self.area.getBody(self.hero)
# make a list of elevators in the level
self.elevators = tmxloader.buildDistributionRects(self.area.tmxdata,
@@ -122,7 +119,10 @@ def activate(self):
res.playMusic(self.area.tmxdata.music)
except AttributeError:
res.fadeoutMusic()
-
+ self.music_playing = False
+ else:
+ self.music_playing = True
+
# load sounds from area
for filename in self.area.soundFiles:
SoundMan.loadSound(filename)
@@ -132,7 +132,7 @@ def deactivate(self):
pass
- def drawSidebar(self, surface, rect):
+ def drawInfobar(self, surface, rect):
# draw the static portions of the sidebar
sw, sh, sw, sh = rect
@@ -152,27 +152,34 @@ def drawSidebar(self, surface, rect):
def draw(self, surface):
- sw, sh = surface.get_size()
+ dirty = []
if self.blank:
self.blank = False
+ sw, sh = surface.get_size()
surface.fill(self.background)
- self.drawSidebar(surface, self.hudBorder)
+ mw = sw
+ mh = sh * .75
+ if not self.camera:
+ self.camera = LevelCamera(self.area,((4,4), (mw, mh)),
+ tmxdata=self.area.tmxdata)
+ self.mapBorder = pygame.Rect((0,0,mw,mh+6))
+ self.msgBorder = pygame.Rect((0,mh,sw,sh-mh))
self.border.draw(surface, self.msgBorder)
- self.camera.blank = True
dirty = [((0,0), (sw, sh))]
# the main map
self.camera.center(self.area.getPosition(self.hero))
- dirty = self.camera.draw(surface)
+ dirty.extend(self.camera.draw(surface))
+ # borders
+ self.border.draw(surface, self.mapBorder)
+
+ # hack
if self.area.drawables:
[ o.draw(surface) for o in self.area.drawables ]
self.blank = True
- # borders
- self.border.draw(surface, self.mapBorder)
-
#log = "\n".join(self.area.messages[-5:])
#rect = self.msgBorder.inflate(-16,-12)
#gui.drawText(surface, log, (0,0,0), rect, self.msgFont)
@@ -181,6 +188,8 @@ def draw(self, surface):
def update(self, time):
+ if self.blank: return
+
self.area.update(time)
self.camera.update(time)
@@ -300,7 +309,14 @@ def elevatorDown(self):
@receiver(emitSound)
def playSound(sender, **kwargs):
- SoundMan.play(kwargs['filename'])
+ x1, y1, z1 = kwargs['position']
+ x2, y2, z2 = hero_body.bbox.origin
+ d = sqrt(pow(x1-x2, 2) + pow(y1-y2, 2) + pow(z1-z2, 2))
+ try:
+ vol = 1/d * 20
+ except ZeroDivisionError:
+ vol = 1.0
+ SoundMan.play(kwargs['filename'], volume=vol)
@receiver(bodyAbsMove)
View
37 lib/renderer.py
@@ -2,6 +2,7 @@
from lib2d.objects import AvatarObject
from pygame import Rect, draw
+import weakref
def screenSorter(x):
@@ -22,27 +23,36 @@ def __init__(self, area, rect, tmxdata=None):
# create a renderer for the map
self.maprender = BufferedTilemapRenderer(tmxdata, rect)
-
self.map_width = tmxdata.tilewidth * tmxdata.width
self.map_height = tmxdata.tileheight*tmxdata.height
- #self.center(self.extent.center)
self.blank = True
- # load the children
- for child in self.area.getChildren():
- child.load()
-
# add the avatars
- for child in self.area.getChildren():
- if isinstance(child, AvatarObject):
- child.avatar.update(0) # hack to re-init avatar
+ #for child in self.area.getChildren():
+ ## if isinstance(child, AvatarObject):
+ # child.avatar.update(0) # hack to re-init avatar
+
+ self.ao = self.refreshAvatarObjects()
+ def refreshAvatarObjects(self):
+ return [ i for i in self.area.getChildren() if hasattr(i, "avatar") ]
+
+
+ # HACK
+ def getAvatarObjects(self):
+ if self.area.changedAvatars:
+ self.ao = self.refreshAvatarObjects()
+ self.area.changedAvatars = False
+ return self.ao
+
+
def set_extent(self, extent):
"""
the camera caches some values related to the extent, so it becomes
nessessary to call this instead of setting the extent directly.
"""
+
self.extent = Rect(extent)
self.half_width = self.extent.width / 2
self.half_height = self.extent.height / 2
@@ -53,8 +63,7 @@ def set_extent(self, extent):
def update(self, time):
self.maprender.update(None)
- [ o.avatar.update(time) for o in self.area.getChildren()
- if hasattr(o, "avatar") ]
+ [ ao.avatar.update(time) for ao in self.getAvatarObjects() ]
def center(self, pos):
@@ -93,14 +102,15 @@ def clear(self, surface):
def draw(self, surface):
- avatarobjects = [ i for i in self.area.getChildren()
- if isinstance(i, AvatarObject) ]
+ avatarobjects = self.getAvatarObjects()
+
onScreen = []
if self.blank:
self.blank = False
self.maprender.blank = True
+ # needs to be optimized!
for a in avatarobjects:
x, y, z, d, w, h, = self.area.getBBox(a)
x, y = self.toSurface((x, y, z))
@@ -111,7 +121,6 @@ def draw(self, surface):
onScreen.append((a, Rect(self.toScreen((x, y)), (w, h))))
onScreen = [ (a.avatar.image, r, 1, a) for a, r in onScreen ]
- #onScreen.sort(key=screenSorter)
return self.maprender.draw(surface, onScreen)
View
29 lib2d/area.py
@@ -169,7 +169,7 @@ def __init__(self):
self._addQueue = []
self._removeQueue = []
self.drawables = [] # HAAAAKCCCCKCK
-
+ self.changedAvatars = True #hack
self._grounded = {}
self.inUpdate = False
@@ -222,6 +222,7 @@ def add(self, thing, pos=None):
self.bodies[thing] = body
AbstractArea.add(self, thing)
#AbstractArea.add(self, body)
+ self.changedAvatars = True
def remove(self, thing):
@@ -231,6 +232,7 @@ def remove(self, thing):
AbstractArea.remove(self, thing)
del self.bodies[thing]
+ self.changedAvatars = True
# hack
try:
@@ -239,6 +241,7 @@ def remove(self, thing):
pass
+
def movePosition(self, body, (x, y, z), push=True, caller=None, \
suppress_warp=False, clip=True):
@@ -465,7 +468,7 @@ def emitSound(self, filename, pos=None, thing=None, ttl=500):
self.sounds = [ s for s in self.sounds if not s.done ]
if filename not in [ s.filename for s in self.sounds ]:
if thing:
- pos = self.bodies[thing]
+ pos = self.bodies[thing].bbox.origin
emitSound.send(sender=self, filename=filename, position=pos)
self.sounds.append(Sound(filename, ttl))
@@ -505,40 +508,32 @@ def updatePhysics(self, body, time):
basic gravity
"""
- time = time / 80
- a = body.acc
-
- # de-accel vertical movement
- if body.isFalling and a.y < 0:
- a += (0, 1)
-
- v = a * time
+ time = time / 100
if body.gravity:
- v += Vec2d((0, 9.8)) * time
+ body.acc += Vec2d((0, 9.8)) * time
- # v is our velocity
+ v = body.acc * time
y, z = v
- body.acc = a
if not y==0:
self.movePosition(body, (0, y, 0))
if z > 0:
falling = self.movePosition(body, (0, 0, z))
- if falling and not body.isFalling:
+ if falling:
body.isFalling = True
self._grounded[body] = False
- elif not falling and body.isFalling:
+ elif not falling:
body.isFalling = False
- self._grounded[body] = True
+ self._grounded[body] = True
+ body.acc.y = 0
elif z < 0:
flying = self.movePosition(body, (0, 0, z))
if flying:
self._grounded[body] = False
body.isFalling = True
-
# platformer
def grounded(self, body):
try:
View
4 lib2d/avatar.py
@@ -130,6 +130,10 @@ def paused(self, value):
self._is_paused = bool(value)
+ def unload(self):
+ self.curImage = None
+
+
def update(self, time):
"""
call this as often as possible with a time. the units in the
View
4 lib2d/buildarea.py
@@ -32,8 +32,8 @@ def toWorld(data, (x, y, l)):
pass
# set the boundries (extent) of this map
- area.setExtent(((0,0), \
- (data.height * data.tileheight, data.width * data.tilewidth)))
+ area.setExtent(((0,0),
+ (data.width * data.tilewidth, data.height * data.tileheight)))
props = data.getTilePropertiesByLayer(-1)
View
2  lib2d/cmenu.py
@@ -53,7 +53,7 @@ def __init__(self, rect, h_pad, v_pad, orientation, number, button_list,
self.font = font # Font to use
self.font_size = font_size
- self.rect = rect # Top left corner (of surface)
+ self.rect = pygame.Rect(rect) # Top left corner (of surface)
self.change_number = number # new row/col #
self.orientation = orientation
self.horizontal_padding = h_pad
View
26 lib2d/statedriver.py
@@ -269,7 +269,31 @@ def run(self):
currentState = originalState
if currentState:
- time = time / 4.0
+ time = time / 10.0
+
+ currentState.update(time)
+ currentState = current_state()
+ if not currentState == originalState: continue
+
+ currentState.update(time)
+ currentState = current_state()
+ if not currentState == originalState: continue
+
+ originalState.update(time)
+ currentState = current_state()
+ if not currentState == originalState: continue
+
+ currentState.update(time)
+ currentState = current_state()
+ if not currentState == originalState: continue
+
+ currentState.update(time)
+ currentState = current_state()
+ if not currentState == originalState: continue
+
+ currentState.update(time)
+ currentState = current_state()
+ if not currentState == originalState: continue
originalState.update(time)
currentState = current_state()
View
25 resources/maps/level1.tmx
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<map version="1.0" orientation="orthogonal" width="45" height="45" tilewidth="16" tileheight="16">
+<map version="1.0" orientation="orthogonal" width="49" height="45" tilewidth="16" tileheight="16">
+ <properties>
+ <property name="music" value="lightlessdawn.ogg"/>
+ </properties>
<tileset firstgid="1" source="controlset.tsx"/>
<tileset firstgid="1905" name="level0" tilewidth="16" tileheight="16">
<image source="../tilesets/level0.png" width="256" height="128"/>
@@ -29,35 +32,35 @@
</properties>
</tile>
</tileset>
- <layer name="Background 1" width="45" height="45">
+ <layer name="Background 1" width="49" height="45">
<data encoding="base64" compression="gzip">
- H4sIAAAAAAAAA+2WUQ7CIAxA9+d9JVHnnzqdv/qhXkhvoDfQc9glNCENjJiUUbAfL4VAyMvWFtpZ06yBW0G06qzOEefOsi1gjM5zy1nA+A48HDc6p84SeAIvx43OMRpBvIGP40bn6swLdVPnaZ07wVDHnL0Oe1dondacBOcYxsaYc+7cHcvnmpx3DLj/l+M8iuR8DlGDc+7c/SW/1VmdQ86cvcg9P2Wv46ppn3OqvqHO5TmP3eUSnadAndW5Rmes8U0BY/qdTwWMqfMCWHrisLZi2sOVG3hvHYDeE4e1I9Merncdzi/A1RNNgj1cb9Hc9aU1qDX4rzW4Lwh0/gJqGsUkpB8AAA==
+ H4sIAAAAAAAAA+2WSw4CIQyG2XFfJ/G18+1WF3oivYHeQM8hE4dIGh4a68xfpyRfgEDGfpEWjHm2iTVmao3opg4Y7Z8clg1zAeOUw6BhDzA+Oc72FRudlxwQuDiuQcx0nnKogLg57kHMdK4O7UJjUwdsB197EaF3F1Jt9bUytU5zGNGhRNX0nzp0ffZz+dAnhwUD4Xng+B5FUj5QJL75UnVMYj54JL+XPO+epa7jzNGHs8RZ+8LfbbO2ctWOmAN3fVKH/jjk3h4SHNpAHTBQBwxK9/TM4o9L/8PO4o9LDkPHKNLXa2OmPb86S/5eXTs2kb5e2zLt+ZaSw8FxjPThN7j2cDug5KvmtOa05jSPw8rKgTo8ADXHOZJ0IgAA
</data>
</layer>
- <layer name="Background 2" width="45" height="45">
+ <layer name="Background 2" width="49" height="45">
<data encoding="base64" compression="gzip">
- H4sIAAAAAAAAA+3TyQ3CQAxA0bm5aLYCCFAAWwEEKIBNlEAJdMIvINJEOVgC/pP+wfJobi5Fkv7TKEoZ04SmNIvc/RBz/mhoQUtaRe5+iDV/bGhLO9pH7v5ZmbsceNPSkU50jtz9qzJ3ufDmSje60yNy9+/KrN9Vu6k+N5etdlN9bi5b7aa8OUmSJEmSJOl7fAApLedkpB8AAA==
+ H4sIAAAAAAAAA+2WMQ7CMAxFs+XGwMYGnIAegiOAQB1gZ4C9A5wDD4mELNE6JVUc9z/JaqO0yXeV79o5AIBlrt65my+t4j8epP9ZeQ4v0v/+kcO6ktz6cqiFVpF+rkWq7Z6Qw2HifLkWqbbu67kj3Z/C+EzXC1tDMt8Hn+fvdwNjy+SurSX+N7k9Hb/JgmIZ1l552V5jtaR4WkKs1RuKbVh752V7jdWS2zcxhz1Fk+jROXmYg55PB+iXdJC7tpZgzvUMyEDd14GFuo+zpAMLZwk9hA7QQ+jAQm2Fp3UAT+vAQq8BT+vAsqc/aHcnmXQiAAA=
</data>
</layer>
- <layer name="Foreground" width="45" height="45">
+ <layer name="Foreground" width="49" height="45">
<data encoding="base64" compression="gzip">
- H4sIAAAAAAAAA+3WsQ2AIBCF4etudt1AN9HSTktHYBJpIR7ExMhh/q/yhcIj4SkiAHBvUZFV7ewRM39jj/MdamdvNi1nj0618xCfR4d7CJrOlmevpjjfrHZGXa1THjuXd+zJeqtzHSrvLHWOcw3gz3q4b+T4LgMA3sJ/EGiLDgJt9dzBC54KWhKkHwAA
+ H4sIAAAAAAAAA+2YOQ7CMBBF0/nQbDV7G/YDsNXsUjooc4SchI9EJGsCjkWw8Rg/6UuefCv2L8aJHIsoiqGcWPBVyOCGfMrACU4ZdtjfXhTrf8pQg1eHGlATagm7/jcydOH1oD40gIbCrv/gimc3UaxVGRKpnmA8hWbQHFqQuab9RFGrMqRSvcR4Ba2hDbQlc037qaKmGdpQ5+ln0rwDxkfoBJ2hC3mnaT97sbe85nQujbC/sSjWnDK8Q7enTVO2lsrX7WnTlK2l8nV72jRla9GelqEZaN9wwPee5oLvGWyerVVw5WytgiqDzbP1Ezj+L1H+5X+JCyGDG4QMbsA1g+69hsuo7jW4wPVegxK+078n9LQbhJ52D64ZQk+7ga89fQeY0KyNdCIAAA==
</data>
</layer>
- <layer name="Elevators" width="45" height="45" visible="0">
+ <layer name="Elevators" width="49" height="45" visible="0">
<properties>
<property name="visible" value="false"/>
</properties>
<data encoding="base64" compression="gzip">
- H4sIAAAAAAAAA+3WMQqAMBAF0RR7QVfvfxaFmEZIJ5MNzIPfT/kzWstnO0mbETYzKjef0Tcc0Wfzv2xm2MyYNVc2a77eVWQzw+Y1bGbYzLCZscPf+LKZYTPDZobNDJsZNjNsZtjMsJlhM2M03wHePdikHwAA
+ H4sIAAAAAAAAA+3WsQnAMBAEQQXfoG31X4uDQ8lHSgQr2IErYLMbI97KbmYDgw0M5IavsuWprLPhLBsYbGDYbSDbbZiVEdnAYAOTDQw2MNjAcONf6mxgsIHBBgYbGGxgsIHBBgYbGGxgsIGhN/wuBHnedCIAAA==
</data>
</layer>
- <layer name="Control" width="45" height="45">
+ <layer name="Control" width="49" height="45" visible="0">
<properties>
<property name="visible" value="false"/>
</properties>
<data encoding="base64" compression="gzip">
- H4sIAAAAAAAAA+3X6Q2AIAwFYJAJHMFjAUfw2H8mQ4iJaTyIodLC+xKiPx9IC7YmsEYfZOa1uPDUlPlgFQ2paEZk5oHMcvSRE5ga3hzeQLJ02hfX5O+1T2M9nXd+zI5lCaK9fW5L3rVtj7vMo6CJ0BosYZ03ss9T3V1quhsBpCCp15WIqxdp6HVXmaVD5n/grAWoB/e/s+RzEECC3HWFGoTa5a6rLzW4A446nkqkHwAA
+ H4sIAAAAAAAAA+2YYQrCMAyFMz2BR5h6AY/g9P5nkv1aCenWyct46fJBoCK89TOklYmIDLJQriORDhzM+56uyzoiug+RynJgQ+83HfZxA+VkH/ipOdwbhV4X5G5sHmovo/rcYx+Y61Pcv3O9jfvYuw9r+VvPtn7r2neeoPJbHZ4OQv9G6pk+Qx++am4Q/8NQeS33WqSzNR04OIuDx9mKpPc+eJx9HtlH9MFyQJIO+5+BztZ5ng5r84HI31qzkw58RHTI9xpcVXOIQg8OJREdcqa5quYQhR4cSiI65ExzlXb4AUhlE8J0IgAA
</data>
</layer>
</map>
View
BIN  resources/tilesets/level0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/worlds/world-data.txt
Binary file not shown
View
15 run.py
@@ -1,23 +1,18 @@
from lib2d.game import Game
-from lib2d.statedriver import driver as sd
-from lib2d import gfx, res
-import pygame, os
+from lib2d import gfx
+import pygame
class TestGame(Game):
def start(self):
- from lib2d.objects import loadObject
- from lib.levelstate import LevelState
-
+ from lib.titlescreen import TitleScreen
gfx.set_screen((640, 480), 2, "scale")
self.sd.reload_screen()
- path = os.path.join("resources", "worlds", "world")
- world = loadObject(path)
- area = world.getChildByGUID(1001)
- self.sd.start(LevelState(area))
+ self.sd.start(TitleScreen())
self.sd.run()
if __name__ == "__main__":
TestGame().start()
+ pygame.quit()
Please sign in to comment.
Something went wrong with that request. Please try again.