* Under Apple MacOS, type "sudo easy_install pygame".
To run the game, type "python molpyup.py".
- See <http://forums.xkcd.com/viewtopic.php?p=4331564#p4331564> for details.
+ See <http://1190.bicyclesonthemoon.info/ott/view?p=4331564#p4331564> for details.
* Under Microsoft Windows, download a Python interpreter from
<https://www.python.org/downloads/>, and install it.
Then type "py -m pip install -U pygame --user" in a command line
to install the pygame library.
To run the game, click on "molpyup.py"
- See <http://forums.xkcd.com/viewtopic.php?p=4331549#p4331549> for details.
+ See <http://1190.bicyclesonthemoon.info/ott/view?p=4331549#p4331549> for details.
In the game, the following keys can be used:
- Use the left and right arrow keys to navigate.
scoreTheEnd = 3089
scoreEpilogue = 3094
- def __init__(self, molpyDown = False):
- self.molpyDown = molpyDown
+ def __init__(self):
+ self.molpyDown = False
self.relativeX=0
self.sx = 553
self.sy = 395
platformY = p[1]
platformScore = 0
- if (platformY < maxY) or (p[2] == self.platformTypeBreaking):
+ if (
+ (p[2] == self.platformTypeBreaking) or
+ (platformY < maxY) or
+ (platformY - self.cameray > self.sy)
+ ):
platformScore = float("-Inf")
p[6] = platformScore
continue
platformScore = float("-Inf")
platformScore *= 4
+ if self.molpyDown:
+ distY = -distY
if distY > 16:
platformScore += distY + distX // 2
else:
self.aiNextPlatformOk = False
if self.molpyDown:
- if self.playerLowestY - self.cameray >= self.sy // 2:
+ if self.playerLowestY - self.cameray >= self.sy // 3:
self.cameray += self.sy // 60
if self.hadTheEnd:
bottom = self.platforms[0][1] + self.platforms[0][8] - self.sy
return
elif self.platforms[-1][2] == self.platformTypeTheEnd:
self.hadTheEnd = True
- platformType = platformWonTheGame
+ platformType = self.platformTypeWonTheGame
w = self.platformWidth[platformType]
h = self.platformHeight[platformType]
y = self.sy * 2 // 3
if self.score > 1:
self.score -= 1
continue
- if self.platforms[-1][1] - self.cameray < - self.platforms[-1][8] - self.sy // 6:
+ if self.platforms[-1][1] - self.cameray < - self.platforms[-1][8]:
self.platforms.pop()
continue
else:
(p[0], p[1] - self.cameray)
)
if self.aiDebag:
- self.screen.blit(self.font.render(str(p[2])+" "+str(p[5])+" "+str(p[6]), -1, (0, 0x57, 0xaf) if self.ai else (0xbb, 0x66, 0x22)), (p[0], p[1] - self.cameray + 16))
+ self.screen.blit(self.font.render(str(p[2])+" "+str(p[5])+" "+str(p[6]), -1, (0, 0x57, 0xaf) if self.ai else (0xbb, 0x66, 0x22)), (p[0], p[1] - self.cameray + p[8]))
if self.aiDebag and self.aiNextPlatformOk:
self.screen.blit(self.imgMolpArrow, (self.aiNextPlatform[0] + (self.aiNextPlatform[7]-self.playerWidth)//2, self.aiNextPlatform[1] - self.cameray + self.aiNextPlatform[8]))
self.waitForIt([K_RETURN])
def run(self):
- if len(sys.argv) > 1:
- self.filename = sys.argv[1]
- else:
- self.filename = None
+ self.filename = None
+ for s in sys.argv[1:]:
+ if s.startswith('-'):
+ if s in ('-d', '--down'):
+ self.molpyDown = True
+ elif self.filename is None:
+ self.filename = sys.argv[1]
+
self.reset()
while True:
self.screen.fill((255,255,255))
self.molpyDown = not self.molpyDown
self.modeText = "Molpy " + ('Down!' if self.molpyDown else 'Up!')
self.hadTheEnd = False
+ if self.score < 1:
+ self.score = 1
for p in self.platforms:
if p[2] == (self.platformTypeFrame1 if self.molpyDown else self.platformTypeWonTheGame):
self.hadTheEnd = True