WinColl 0.9.6__tar.gz → 0.9.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wincoll-0.9.6 → wincoll-0.9.8}/PKG-INFO +1 -1
- {wincoll-0.9.6 → wincoll-0.9.8}/WinColl.egg-info/PKG-INFO +1 -1
- {wincoll-0.9.6 → wincoll-0.9.8}/WinColl.egg-info/SOURCES.txt +1 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/pyproject.toml +2 -1
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/__init__.py +125 -111
- wincoll-0.9.8/wincoll/levels/01.tmx +61 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/locale/el/LC_MESSAGES/wincoll.mo +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/locale/fr/LC_MESSAGES/wincoll.mo +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/README.md +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/WinColl.egg-info/dependency_links.txt +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/WinColl.egg-info/entry_points.txt +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/WinColl.egg-info/requires.txt +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/WinColl.egg-info/top_level.txt +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/setup.cfg +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/Collect.wav +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/Slide.wav +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/Splat.wav +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/Unlock.wav +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/__main__.py +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/acorn-mode-1.ttf +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/diamond.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/langdetect.py +0 -0
- /wincoll-0.9.6/wincoll/levels/01.tmx → /wincoll-0.9.8/wincoll/levels/02.tmx +0 -0
- /wincoll-0.9.6/wincoll/levels/02.tmx → /wincoll-0.9.8/wincoll/levels/03.tmx +0 -0
- /wincoll-0.9.6/wincoll/levels/03.tmx → /wincoll-0.9.8/wincoll/levels/04.tmx +0 -0
- /wincoll-0.9.6/wincoll/levels/04.tmx → /wincoll-0.9.8/wincoll/levels/05.tmx +0 -0
- /wincoll-0.9.6/wincoll/levels/05.tmx → /wincoll-0.9.8/wincoll/levels/06.tmx +0 -0
- /wincoll-0.9.6/wincoll/levels/06.tmx → /wincoll-0.9.8/wincoll/levels/07.tmx +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Blob.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Brick.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Diamond.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Earth.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Gap.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Key.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Rock.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Safe.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/Win.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/levels/WinColl.tsx +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/locale/fr/LC_MESSAGES/argparse.mo +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/ptext.py +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/splat.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/title.png +0 -0
- {wincoll-0.9.6 → wincoll-0.9.8}/wincoll/warnings_util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "WinColl"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.8"
|
|
4
4
|
description = "Simple rocks-and-diamonds game"
|
|
5
5
|
license = {text = "GPL v3 or later"}
|
|
6
6
|
authors = [
|
|
@@ -75,6 +75,7 @@ disable = [
|
|
|
75
75
|
"too-many-locals",
|
|
76
76
|
"too-many-nested-blocks",
|
|
77
77
|
"too-many-positional-arguments",
|
|
78
|
+
"too-many-statements",
|
|
78
79
|
]
|
|
79
80
|
enable = [
|
|
80
81
|
"useless-suppression",
|
|
@@ -41,6 +41,7 @@ os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "1"
|
|
|
41
41
|
with warnings.catch_warnings():
|
|
42
42
|
warnings.simplefilter("ignore")
|
|
43
43
|
import pygame
|
|
44
|
+
from pygame import Vector2
|
|
44
45
|
import pyscroll # type: ignore
|
|
45
46
|
import pytmx # type: ignore
|
|
46
47
|
from . import ptext
|
|
@@ -167,7 +168,8 @@ def handle_global_keys(event: pygame.event.Event) -> None:
|
|
|
167
168
|
pygame.display.toggle_fullscreen()
|
|
168
169
|
|
|
169
170
|
|
|
170
|
-
FRAMES_PER_SECOND =
|
|
171
|
+
FRAMES_PER_SECOND = 50
|
|
172
|
+
SCROLL_FRAMES_PER_SECOND = 10
|
|
171
173
|
|
|
172
174
|
|
|
173
175
|
def scale_surface(surface: pygame.Surface) -> pygame.Surface:
|
|
@@ -213,7 +215,7 @@ class WincollGame:
|
|
|
213
215
|
self.group = pyscroll.PyscrollGroup(map_layer=self.map_layer)
|
|
214
216
|
|
|
215
217
|
self.hero = Win()
|
|
216
|
-
self.hero.position =
|
|
218
|
+
self.hero.position = Vector2(0, 0)
|
|
217
219
|
self.group.add(self.hero)
|
|
218
220
|
self.diamonds = 0
|
|
219
221
|
self.survey()
|
|
@@ -222,7 +224,7 @@ class WincollGame:
|
|
|
222
224
|
self.restart_level()
|
|
223
225
|
self.save_position()
|
|
224
226
|
|
|
225
|
-
def get(self, pos:
|
|
227
|
+
def get(self, pos: Vector2) -> int:
|
|
226
228
|
# Anything outside the map is a brick
|
|
227
229
|
x, y = int(pos.x), int(pos.y)
|
|
228
230
|
if not ((0 <= x < level_size) and (0 <= y < level_size)):
|
|
@@ -232,7 +234,7 @@ class WincollGame:
|
|
|
232
234
|
block = self.gids[TilesetGids.GAP]
|
|
233
235
|
return block # type: ignore[no-any-return]
|
|
234
236
|
|
|
235
|
-
def set(self, pos:
|
|
237
|
+
def set(self, pos: Vector2, gid: int) -> None:
|
|
236
238
|
self.map_blocks[int(pos.y)][int(pos.x)] = gid
|
|
237
239
|
# Update map
|
|
238
240
|
# FIXME: We invoke protected methods and access protected members.
|
|
@@ -254,7 +256,7 @@ class WincollGame:
|
|
|
254
256
|
map_blocks = pickle.load(fh)
|
|
255
257
|
for row, blocks in enumerate(map_blocks):
|
|
256
258
|
for col, block in enumerate(blocks):
|
|
257
|
-
self.set(
|
|
259
|
+
self.set(Vector2(col, row), block)
|
|
258
260
|
self.survey()
|
|
259
261
|
|
|
260
262
|
def survey(self) -> None:
|
|
@@ -268,7 +270,7 @@ class WincollGame:
|
|
|
268
270
|
):
|
|
269
271
|
self.diamonds += 1
|
|
270
272
|
elif block == self.gids[TilesetGids.WIN]:
|
|
271
|
-
self.hero.position =
|
|
273
|
+
self.hero.position = Vector2(col, row)
|
|
272
274
|
self.set(self.hero.position, self.gids[TilesetGids.WIN_PLACE])
|
|
273
275
|
|
|
274
276
|
def unlock(self) -> None:
|
|
@@ -276,7 +278,7 @@ class WincollGame:
|
|
|
276
278
|
for row, blocks in enumerate(self.map_blocks):
|
|
277
279
|
for col, block in enumerate(blocks):
|
|
278
280
|
if block == self.gids[TilesetGids.SAFE]:
|
|
279
|
-
self.set(
|
|
281
|
+
self.set(Vector2(col, row), self.gids[TilesetGids.DIAMOND])
|
|
280
282
|
UNLOCK_SOUND.play()
|
|
281
283
|
|
|
282
284
|
def draw(self) -> None:
|
|
@@ -296,68 +298,80 @@ class WincollGame:
|
|
|
296
298
|
if axes >= 2: # Hopefully 0=L/R and 1=U/D
|
|
297
299
|
lr = joystick.get_axis(0)
|
|
298
300
|
if lr < -0.5:
|
|
299
|
-
self.hero.velocity =
|
|
301
|
+
self.hero.velocity = Vector2(-1, 0)
|
|
300
302
|
elif lr > 0.5:
|
|
301
|
-
self.hero.velocity =
|
|
303
|
+
self.hero.velocity = Vector2(1, 0)
|
|
302
304
|
ud = joystick.get_axis(1)
|
|
303
305
|
if ud < -0.5:
|
|
304
|
-
self.hero.velocity =
|
|
306
|
+
self.hero.velocity = Vector2(0, -1)
|
|
305
307
|
elif ud > 0.5:
|
|
306
|
-
self.hero.velocity =
|
|
308
|
+
self.hero.velocity = Vector2(0, 1)
|
|
307
309
|
|
|
308
310
|
def handle_input(self) -> None:
|
|
309
311
|
pressed = pygame.key.get_pressed()
|
|
310
|
-
|
|
312
|
+
dx, dy = (0, 0)
|
|
311
313
|
if pressed[pygame.K_LEFT] or pressed[pygame.K_z]:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
314
|
+
dx -= 1
|
|
315
|
+
if pressed[pygame.K_RIGHT] or pressed[pygame.K_x]:
|
|
316
|
+
dx += 1
|
|
317
|
+
if pressed[pygame.K_UP] or pressed[pygame.K_QUOTE]:
|
|
318
|
+
dy -= 1
|
|
319
|
+
if pressed[pygame.K_DOWN] or pressed[pygame.K_SLASH]:
|
|
320
|
+
dy += 1
|
|
321
|
+
if dx != 0 and self.can_move(Vector2(dx, 0)):
|
|
322
|
+
self.hero.velocity = Vector2(dx, 0)
|
|
323
|
+
elif dy != 0 and self.can_move(Vector2(0, dy)):
|
|
324
|
+
self.hero.velocity = Vector2(0, dy)
|
|
325
|
+
if pressed[pygame.K_l]:
|
|
320
326
|
flash_background()
|
|
321
327
|
self.load_position()
|
|
322
328
|
elif pressed[pygame.K_s]:
|
|
323
329
|
flash_background()
|
|
324
330
|
self.save_position()
|
|
325
|
-
|
|
331
|
+
if pressed[pygame.K_r]:
|
|
326
332
|
flash_background()
|
|
327
333
|
self.restart_level()
|
|
328
|
-
|
|
334
|
+
if pressed[pygame.K_q]:
|
|
329
335
|
self.quit = True
|
|
330
336
|
self.handle_joysticks()
|
|
331
337
|
|
|
332
|
-
def
|
|
338
|
+
def can_move(self, velocity: Vector2) -> bool:
|
|
339
|
+
newpos = self.hero.position + velocity
|
|
340
|
+
block = self.get(newpos)
|
|
341
|
+
if block in (
|
|
342
|
+
self.gids[TilesetGids.GAP],
|
|
343
|
+
self.gids[TilesetGids.EARTH],
|
|
344
|
+
self.gids[TilesetGids.DIAMOND],
|
|
345
|
+
self.gids[TilesetGids.KEY],
|
|
346
|
+
):
|
|
347
|
+
return True
|
|
348
|
+
if block == self.gids[TilesetGids.ROCK]:
|
|
349
|
+
new_rockpos = self.hero.position + velocity * 2
|
|
350
|
+
return (
|
|
351
|
+
velocity.y == 0
|
|
352
|
+
and self.get(new_rockpos) == self.gids[TilesetGids.GAP]
|
|
353
|
+
)
|
|
354
|
+
return False
|
|
355
|
+
|
|
356
|
+
def do_move(self) -> None:
|
|
333
357
|
newpos = self.hero.position + self.hero.velocity
|
|
334
358
|
block = self.get(newpos)
|
|
335
|
-
if block
|
|
336
|
-
pass
|
|
337
|
-
elif block == self.gids[TilesetGids.DIAMOND]:
|
|
359
|
+
if block == self.gids[TilesetGids.DIAMOND]:
|
|
338
360
|
COLLECT_SOUND.play()
|
|
339
361
|
self.diamonds -= 1
|
|
340
362
|
elif block == self.gids[TilesetGids.KEY]:
|
|
341
363
|
self.unlock()
|
|
342
364
|
elif block == self.gids[TilesetGids.ROCK]:
|
|
343
365
|
new_rockpos = self.hero.position + (self.hero.velocity * 2)
|
|
344
|
-
|
|
345
|
-
self.hero.velocity.y == 0
|
|
346
|
-
and self.get(new_rockpos) == self.gids[TilesetGids.GAP]
|
|
347
|
-
):
|
|
348
|
-
self.set(new_rockpos, self.gids[TilesetGids.ROCK])
|
|
349
|
-
else:
|
|
350
|
-
self.hero.velocity = pygame.Vector2(0, 0)
|
|
351
|
-
else:
|
|
352
|
-
self.hero.velocity = pygame.Vector2(0, 0)
|
|
366
|
+
self.set(new_rockpos, self.gids[TilesetGids.ROCK])
|
|
353
367
|
self.set(self.hero.position, self.gids[TilesetGids.GAP])
|
|
354
368
|
self.set(
|
|
355
369
|
self.hero.position + self.hero.velocity, self.gids[TilesetGids.WIN_PLACE]
|
|
356
370
|
)
|
|
357
371
|
|
|
358
|
-
def can_roll(self, pos:
|
|
372
|
+
def can_roll(self, pos: Vector2) -> bool:
|
|
359
373
|
side_block = self.get(pos)
|
|
360
|
-
side_below_block = self.get(pos +
|
|
374
|
+
side_below_block = self.get(pos + Vector2(0, 1))
|
|
361
375
|
return (
|
|
362
376
|
side_block == self.gids[TilesetGids.GAP]
|
|
363
377
|
and side_below_block == self.gids[TilesetGids.GAP]
|
|
@@ -366,8 +380,8 @@ class WincollGame:
|
|
|
366
380
|
def rockfall(self) -> None:
|
|
367
381
|
new_fall = False
|
|
368
382
|
|
|
369
|
-
def fall(oldpos:
|
|
370
|
-
block_below = self.get(newpos +
|
|
383
|
+
def fall(oldpos: Vector2, newpos: Vector2) -> None:
|
|
384
|
+
block_below = self.get(newpos + Vector2(0, 1))
|
|
371
385
|
if block_below == self.gids[TilesetGids.WIN_PLACE]:
|
|
372
386
|
self.dead = True
|
|
373
387
|
self.set(oldpos, self.gids[TilesetGids.GAP])
|
|
@@ -381,8 +395,8 @@ class WincollGame:
|
|
|
381
395
|
for row, blocks in reversed(list(enumerate(self.map_blocks))):
|
|
382
396
|
for col, block in enumerate(blocks):
|
|
383
397
|
if block == self.gids[TilesetGids.ROCK]:
|
|
384
|
-
pos =
|
|
385
|
-
pos_below = pos +
|
|
398
|
+
pos = Vector2(col, row)
|
|
399
|
+
pos_below = pos + Vector2(0, 1)
|
|
386
400
|
block_below = self.get(pos_below)
|
|
387
401
|
if block_below == self.gids[TilesetGids.GAP]:
|
|
388
402
|
fall(pos, pos_below)
|
|
@@ -392,13 +406,13 @@ class WincollGame:
|
|
|
392
406
|
self.gids[TilesetGids.DIAMOND],
|
|
393
407
|
self.gids[TilesetGids.BLOB],
|
|
394
408
|
):
|
|
395
|
-
pos_left = pos +
|
|
409
|
+
pos_left = pos + Vector2(-1, 0)
|
|
396
410
|
if self.can_roll(pos_left):
|
|
397
|
-
fall(pos, pos_left +
|
|
411
|
+
fall(pos, pos_left + Vector2(0, 1))
|
|
398
412
|
else:
|
|
399
|
-
pos_right = pos +
|
|
413
|
+
pos_right = pos + Vector2(1, 0)
|
|
400
414
|
if self.can_roll(pos_right):
|
|
401
|
-
fall(pos, pos_right +
|
|
415
|
+
fall(pos, pos_right + Vector2(0, 1))
|
|
402
416
|
|
|
403
417
|
if new_fall is False:
|
|
404
418
|
self.falling = False
|
|
@@ -440,58 +454,66 @@ class WincollGame:
|
|
|
440
454
|
|
|
441
455
|
def run(self) -> None:
|
|
442
456
|
clock = pygame.time.Clock()
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
self.
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
457
|
+
while not self.quit and self.level <= levels:
|
|
458
|
+
self.start_level()
|
|
459
|
+
self.show_status()
|
|
460
|
+
self.show_screen()
|
|
461
|
+
while not self.quit and self.diamonds > 0:
|
|
462
|
+
self.load_position()
|
|
463
|
+
subframes = 4 # FIXME: global constant
|
|
464
|
+
subframe = 0
|
|
465
|
+
while not self.quit and not self.dead and self.diamonds > 0:
|
|
466
|
+
clock.tick(FRAMES_PER_SECOND)
|
|
467
|
+
for event in pygame.event.get():
|
|
468
|
+
if event.type == pygame.QUIT:
|
|
469
|
+
quit_game()
|
|
470
|
+
elif event.type == pygame.KEYDOWN:
|
|
456
471
|
handle_global_keys(event)
|
|
472
|
+
elif event.type == pygame.JOYDEVICEADDED:
|
|
473
|
+
joy = pygame.joystick.Joystick(event.device_index)
|
|
474
|
+
self.joysticks[joy.get_instance_id()] = joy
|
|
475
|
+
elif event.type == pygame.JOYDEVICEREMOVED:
|
|
476
|
+
del self.joysticks[event.instance_id]
|
|
477
|
+
if self.hero.velocity == Vector2(0, 0):
|
|
457
478
|
self.handle_input()
|
|
458
|
-
if self.
|
|
459
|
-
self.
|
|
460
|
-
|
|
461
|
-
|
|
479
|
+
if self.hero.velocity != Vector2(0, 0):
|
|
480
|
+
self.do_move()
|
|
481
|
+
subframe = 0
|
|
482
|
+
if subframe == subframes - 1:
|
|
462
483
|
self.rockfall()
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
),
|
|
478
|
-
)
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
self.group.update(1 / subframes)
|
|
485
|
+
self.draw()
|
|
486
|
+
self.show_status()
|
|
487
|
+
self.show_screen()
|
|
488
|
+
pygame.time.wait(1000 // SCROLL_FRAMES_PER_SECOND // subframes)
|
|
489
|
+
subframe = (subframe + 1) % subframes
|
|
490
|
+
if subframe == 0:
|
|
491
|
+
self.hero.velocity = Vector2(0, 0)
|
|
492
|
+
SLIDE_SOUND.stop()
|
|
493
|
+
if self.dead:
|
|
494
|
+
SPLAT_SOUND.play()
|
|
495
|
+
self.game_surface.blit(
|
|
496
|
+
SPLAT_IMAGE,
|
|
497
|
+
self.game_to_screen(
|
|
498
|
+
int(self.hero.position.x), int(self.hero.position.y)
|
|
499
|
+
),
|
|
500
|
+
)
|
|
501
|
+
self.show_status()
|
|
502
|
+
self.show_screen()
|
|
503
|
+
pygame.time.wait(1000)
|
|
504
|
+
self.dead = False
|
|
505
|
+
if self.diamonds == 0:
|
|
483
506
|
self.level += 1
|
|
507
|
+
if self.level > levels:
|
|
484
508
|
self.splurge(Win().image)
|
|
485
|
-
finally:
|
|
486
|
-
SLIDE_SOUND.stop()
|
|
487
509
|
|
|
488
510
|
|
|
489
511
|
class Win(pygame.sprite.Sprite): # pylint: disable=too-few-public-methods
|
|
490
512
|
def __init__(self) -> None:
|
|
491
513
|
pygame.sprite.Sprite.__init__(self)
|
|
492
514
|
self.image = load_image("levels/Win.png")
|
|
493
|
-
self.velocity =
|
|
494
|
-
self.position =
|
|
515
|
+
self.velocity = Vector2(0, 0)
|
|
516
|
+
self.position = Vector2(0, 0)
|
|
495
517
|
self.rect = self.image.get_rect()
|
|
496
518
|
|
|
497
519
|
def update(self, dt: float) -> None:
|
|
@@ -505,19 +527,6 @@ def clear_keys() -> None:
|
|
|
505
527
|
pass
|
|
506
528
|
|
|
507
529
|
|
|
508
|
-
def get_key() -> int:
|
|
509
|
-
"""Return first key press."""
|
|
510
|
-
while True:
|
|
511
|
-
handle_quit_event()
|
|
512
|
-
for event in pygame.event.get(pygame.KEYDOWN):
|
|
513
|
-
if event.key == pygame.K_ESCAPE:
|
|
514
|
-
quit_game()
|
|
515
|
-
else:
|
|
516
|
-
handle_global_keys(event)
|
|
517
|
-
key: int = event.key
|
|
518
|
-
return key
|
|
519
|
-
|
|
520
|
-
|
|
521
530
|
DIGIT_KEYS = {
|
|
522
531
|
pygame.K_0: 0,
|
|
523
532
|
pygame.K_1: 1,
|
|
@@ -569,7 +578,8 @@ Avoid falling rocks!
|
|
|
569
578
|
start_level_y = (
|
|
570
579
|
instructions_y + len(instructions.split("\n\n\n")[0].split("\n")) + 1
|
|
571
580
|
)
|
|
572
|
-
|
|
581
|
+
play = False
|
|
582
|
+
while not play:
|
|
573
583
|
reinit_screen()
|
|
574
584
|
screen.blit(
|
|
575
585
|
scale_surface(TITLE_IMAGE.convert()),
|
|
@@ -583,18 +593,22 @@ Avoid falling rocks!
|
|
|
583
593
|
align="center",
|
|
584
594
|
)
|
|
585
595
|
pygame.display.flip()
|
|
586
|
-
|
|
596
|
+
handle_quit_event()
|
|
597
|
+
for event in pygame.event.get(pygame.KEYDOWN):
|
|
598
|
+
if event.key == pygame.K_ESCAPE:
|
|
599
|
+
quit_game()
|
|
600
|
+
if event.key == pygame.K_SPACE:
|
|
601
|
+
play = True
|
|
602
|
+
if event.key in (pygame.K_z, pygame.K_LEFT, pygame.K_SLASH, pygame.K_DOWN):
|
|
603
|
+
level = max(1, level - 1)
|
|
604
|
+
elif event.key in (pygame.K_x, pygame.K_RIGHT, pygame.K_QUOTE, pygame.K_UP):
|
|
605
|
+
level = min(levels, level + 1)
|
|
606
|
+
elif event.key in DIGIT_KEYS:
|
|
607
|
+
level = min(levels, level * 10 + DIGIT_KEYS[event.key])
|
|
608
|
+
else:
|
|
609
|
+
level = 0
|
|
610
|
+
handle_global_keys(event)
|
|
587
611
|
clock.tick(FRAMES_PER_SECOND)
|
|
588
|
-
if key == pygame.K_SPACE:
|
|
589
|
-
break
|
|
590
|
-
if key in (pygame.K_z, pygame.K_LEFT, pygame.K_SLASH, pygame.K_DOWN):
|
|
591
|
-
level = max(1, level - 1)
|
|
592
|
-
elif key in (pygame.K_x, pygame.K_RIGHT, pygame.K_QUOTE, pygame.K_UP):
|
|
593
|
-
level = min(levels, level + 1)
|
|
594
|
-
elif key in DIGIT_KEYS:
|
|
595
|
-
level = min(levels, level * 10 + DIGIT_KEYS[key])
|
|
596
|
-
else:
|
|
597
|
-
level = 0
|
|
598
612
|
return max(min(level, levels), 1)
|
|
599
613
|
|
|
600
614
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="50" height="50" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="1">
|
|
3
|
+
<properties>
|
|
4
|
+
<property name="Title" value="A gentle introduction"/>
|
|
5
|
+
</properties>
|
|
6
|
+
<tileset firstgid="1" source="WinColl.tsx"/>
|
|
7
|
+
<layer id="1" name="Tile Layer 1" width="50" height="50">
|
|
8
|
+
<data encoding="csv">
|
|
9
|
+
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12,16,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,
|
|
10
|
+
15,16,15,15,15,15,15,13,15,15,16,15,15,11,15,15,10,15,15,12,16,16,16,10,10,10,10,10,10,10,10,10,10,11,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,
|
|
11
|
+
15,15,16,13,15,11,15,15,10,15,15,15,15,16,15,15,15,15,15,12,13,14,11,11,11,11,11,11,11,11,11,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,
|
|
12
|
+
15,15,15,15,17,15,15,15,15,16,15,15,15,15,16,15,13,15,14,12,11,17,11,10,11,11,11,11,10,11,17,11,10,11,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,
|
|
13
|
+
11,15,15,16,15,15,14,15,11,15,15,10,11,15,11,15,15,14,11,12,11,11,10,11,11,11,11,11,11,10,11,11,10,11,11,11,11,11,16,11,11,11,16,11,11,11,16,11,11,11,
|
|
14
|
+
15,15,14,15,15,15,15,15,15,15,15,13,15,16,15,15,14,11,11,12,11,10,11,11,11,15,15,11,11,11,10,11,10,11,13,10,10,10,15,13,13,13,15,13,13,13,15,13,13,11,
|
|
15
|
+
15,15,15,15,16,15,10,15,15,15,15,15,15,15,15,14,11,11,11,12,11,11,11,15,15,10,10,15,15,11,11,11,10,11,11,11,11,11,15,11,15,11,15,11,15,11,15,11,15,11,
|
|
16
|
+
15,16,15,15,11,15,15,15,14,15,16,17,15,15,14,11,11,11,16,12,11,11,15,10,10,10,10,10,10,15,11,11,10,11,11,10,11,11,15,11,15,11,15,11,15,11,15,11,15,11,
|
|
17
|
+
15,15,15,10,15,14,15,15,15,15,15,15,15,14,11,11,11,11,17,12,11,11,15,10,13,10,10,13,10,15,11,11,13,11,10,11,11,11,15,11,15,11,15,11,15,11,15,11,15,11,
|
|
18
|
+
10,15,14,15,15,15,15,16,11,15,15,15,14,11,11,11,11,11,11,12,11,15,10,10,10,10,10,10,10,10,15,10,10,11,11,11,10,10,13,13,15,13,13,13,15,13,13,13,15,11,
|
|
19
|
+
15,15,16,15,15,15,15,15,15,15,16,15,14,11,11,11,11,11,11,12,16,15,10,10,14,10,10,14,10,10,15,11,11,11,11,13,10,11,11,11,16,11,11,11,16,11,11,11,16,11,
|
|
20
|
+
13,15,15,15,15,14,15,10,15,14,15,15,14,11,11,17,17,11,11,12,14,11,15,10,10,14,14,10,10,15,11,11,11,10,11,10,11,16,11,16,11,16,11,16,11,16,11,16,11,11,
|
|
21
|
+
15,14,15,13,15,15,15,15,16,15,15,15,14,11,17,11,11,17,11,12,11,11,15,10,10,10,10,10,10,15,11,11,10,11,11,10,11,11,16,11,11,11,16,11,11,11,16,11,11,11,
|
|
22
|
+
15,15,10,15,17,15,16,15,15,15,15,16,14,11,17,11,11,17,11,12,11,11,11,15,15,10,10,15,15,11,11,11,11,11,10,13,11,13,11,16,11,16,11,16,11,16,11,16,11,11,
|
|
23
|
+
15,15,15,16,15,14,15,15,15,13,15,15,14,11,11,17,17,11,11,12,11,10,11,11,11,15,15,11,11,11,10,11,11,10,10,11,16,16,16,11,16,11,11,11,16,11,11,11,16,11,
|
|
24
|
+
16,15,15,15,15,15,15,15,14,15,15,15,14,11,11,11,17,11,11,12,11,11,10,11,11,10,11,11,11,10,11,11,11,10,11,16,16,16,16,16,11,16,11,16,11,16,11,16,11,11,
|
|
25
|
+
11,15,14,15,15,15,16,15,15,11,15,14,14,11,11,11,17,11,11,12,11,17,11,10,11,10,11,11,10,11,17,11,11,10,11,16,16,16,16,16,11,11,16,11,11,11,16,11,11,11,
|
|
26
|
+
15,15,15,10,16,14,15,15,15,16,15,15,14,11,17,17,17,11,11,12,11,11,11,11,11,13,11,11,11,11,11,11,11,10,11,13,16,16,16,13,11,16,13,16,11,16,13,16,11,11,
|
|
27
|
+
15,16,15,15,15,15,15,14,15,15,15,15,14,11,11,11,17,11,11,12,16,11,11,11,13,10,13,11,11,11,11,11,11,10,11,11,13,16,13,11,16,13,13,13,16,13,13,13,16,11,
|
|
28
|
+
15,15,15,14,15,15,15,15,15,15,15,14,11,11,17,17,17,11,11,12,13,11,11,13,10,10,10,13,11,11,11,11,10,10,10,11,11,16,11,11,11,16,13,16,13,16,13,16,13,11,
|
|
29
|
+
15,11,15,17,15,14,15,15,16,15,14,11,11,11,11,11,11,11,11,12,11,11,13,10,10,13,10,10,13,10,10,10,10,13,10,10,10,13,13,14,11,11,16,13,13,13,16,13,13,11,
|
|
30
|
+
15,16,15,15,15,15,11,10,15,14,11,11,11,11,11,11,11,11,16,12,11,11,11,13,10,10,10,13,11,11,11,11,10,10,10,11,11,14,13,13,14,11,11,16,13,16,13,16,13,11,
|
|
31
|
+
15,15,10,15,13,15,15,15,14,14,11,11,11,16,16,11,11,11,15,12,11,11,11,11,13,10,13,11,11,11,11,11,11,10,11,11,11,11,14,13,13,14,11,11,16,13,13,13,16,11,
|
|
32
|
+
15,15,14,15,15,15,16,15,15,14,11,11,16,16,16,16,11,11,11,12,16,11,11,11,11,13,11,11,11,11,17,11,11,10,11,11,17,11,11,14,13,13,14,11,11,16,13,16,13,11,
|
|
33
|
+
10,15,15,15,16,15,15,17,15,14,11,16,16,16,16,16,16,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,16,15,16,11,11,11,11,11,14,13,13,14,11,11,16,13,13,11,
|
|
34
|
+
13,15,15,15,15,10,15,14,15,14,11,16,16,16,16,16,16,11,11,12,16,10,10,10,10,10,10,10,10,10,10,10,16,15,16,11,11,11,11,10,11,14,13,13,14,11,11,16,13,11,
|
|
35
|
+
15,14,15,14,15,15,15,15,15,14,11,11,16,16,16,16,11,11,10,12,11,11,11,11,11,11,11,11,11,11,11,11,16,15,16,11,11,11,10,10,11,11,14,13,13,14,11,11,16,11,
|
|
36
|
+
15,15,15,15,16,14,14,14,14,14,11,11,11,16,16,11,11,10,10,12,11,16,16,16,16,16,16,16,11,11,11,11,16,15,16,11,11,11,10,10,10,11,11,14,13,13,14,15,15,11,
|
|
37
|
+
17,16,10,15,14,16,16,16,16,16,14,11,11,11,11,11,10,10,10,12,11,11,11,11,15,11,11,11,16,11,16,11,16,15,16,11,11,10,11,10,10,11,11,11,14,13,10,10,10,11,
|
|
38
|
+
15,15,15,15,14,13,16,16,16,13,14,12,12,13,12,12,12,12,12,12,11,11,11,11,15,11,11,11,11,16,11,11,16,15,16,11,11,10,11,10,10,10,11,11,11,10,11,10,10,11,
|
|
39
|
+
15,16,15,14,15,14,14,16,14,14,11,12,11,15,11,11,16,11,11,11,11,11,11,11,15,11,11,11,16,11,11,11,13,15,16,11,10,11,11,11,10,10,11,11,11,10,11,10,10,11,
|
|
40
|
+
10,15,15,15,15,14,10,13,15,15,15,15,15,15,15,15,13,10,10,10,10,10,16,16,15,16,16,11,11,16,11,10,15,16,11,11,10,10,10,10,10,10,10,11,11,10,11,10,10,11,
|
|
41
|
+
15,15,15,15,14,10,10,14,11,11,16,12,16,11,11,11,10,11,11,11,11,11,14,16,16,16,14,11,16,11,11,10,14,11,11,10,10,11,11,11,11,10,10,11,11,10,11,10,10,11,
|
|
42
|
+
15,14,13,14,10,10,14,11,16,11,16,12,16,11,11,13,11,16,11,16,16,16,11,14,16,14,11,11,11,16,11,10,10,11,10,10,10,10,11,11,10,10,10,10,11,10,11,10,10,11,
|
|
43
|
+
15,13,14,10,10,14,13,11,16,11,16,12,16,11,13,13,11,11,11,11,11,16,11,11,15,15,11,11,16,11,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,11,
|
|
44
|
+
13,14,10,10,14,11,13,11,16,11,16,12,16,13,13,13,13,13,13,13,11,16,11,11,15,11,11,16,11,16,11,10,10,10,10,11,11,11,11,11,11,11,11,11,11,10,11,10,10,11,
|
|
45
|
+
14,10,10,14,16,11,13,11,16,11,16,12,16,11,13,13,11,11,11,11,11,16,11,11,15,11,16,11,11,11,16,11,10,10,10,10,11,11,11,11,11,11,17,11,11,10,11,10,10,11,
|
|
46
|
+
11,10,14,11,11,11,13,15,15,15,16,12,11,16,11,13,11,16,11,16,16,16,11,11,16,11,11,16,11,16,11,16,11,10,10,10,10,11,11,11,11,11,11,11,11,10,11,10,10,11,
|
|
47
|
+
11,10,10,14,13,13,13,13,13,11,16,12,11,17,16,11,11,11,11,11,11,11,11,15,15,15,11,11,16,11,11,11,16,11,10,10,10,11,11,11,11,11,11,11,11,10,11,10,10,11,
|
|
48
|
+
11,13,10,10,14,13,13,13,11,11,16,12,11,17,17,16,11,11,11,11,11,11,15,15,15,15,15,11,11,16,11,16,11,11,11,14,10,11,11,11,13,16,16,16,11,10,11,10,10,11,
|
|
49
|
+
11,10,13,10,10,14,13,11,17,11,11,10,11,17,17,17,16,17,17,17,11,15,15,15,15,15,15,15,11,11,16,11,16,11,11,10,10,11,11,11,16,16,16,16,11,10,11,10,10,11,
|
|
50
|
+
11,10,10,10,10,10,14,17,17,11,16,16,16,11,11,11,11,16,17,17,11,15,15,15,13,15,15,15,11,16,11,11,11,10,10,10,10,11,11,11,15,15,15,15,15,15,11,10,10,11,
|
|
51
|
+
11,10,12,13,10,10,10,14,17,11,12,15,12,11,16,11,13,11,16,17,11,15,15,15,10,15,15,15,11,11,11,10,10,10,10,10,11,11,11,13,10,10,10,10,11,10,10,10,10,11,
|
|
52
|
+
11,10,11,12,13,10,10,10,14,11,10,10,10,11,11,11,13,13,11,16,11,15,15,15,10,15,15,15,11,11,11,10,10,10,10,11,11,11,13,10,10,10,11,11,11,10,11,11,11,11,
|
|
53
|
+
11,10,11,11,12,12,10,10,10,11,10,15,13,13,13,13,13,13,13,11,15,15,15,10,10,10,15,15,11,11,10,10,10,14,11,11,11,11,13,10,10,11,11,11,11,10,11,11,11,11,
|
|
54
|
+
11,10,11,11,11,12,13,10,10,11,10,12,14,11,11,11,13,13,11,15,15,15,10,10,10,10,10,11,11,11,10,10,10,10,11,11,11,13,10,10,11,11,11,11,10,10,10,11,11,11,
|
|
55
|
+
11,17,12,12,12,12,12,13,10,11,11,10,16,11,16,11,13,11,15,15,15,13,10,10,10,10,11,11,11,10,10,10,10,10,10,10,10,10,10,10,11,11,11,10,10,10,10,10,11,11,
|
|
56
|
+
11,11,11,16,11,11,11,11,11,11,11,16,14,11,11,11,11,15,15,15,10,10,10,10,10,11,11,17,11,10,10,10,10,10,10,10,10,10,10,11,11,11,10,10,10,10,10,10,10,11,
|
|
57
|
+
11,18,15,15,15,15,15,15,15,15,10,13,10,15,15,15,15,15,15,10,10,10,10,10,11,11,17,17,11,13,13,13,13,13,13,13,11,11,11,11,11,11,10,10,10,13,10,10,10,11,
|
|
58
|
+
11,11,10,14,11,11,11,11,11,11,10,16,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11
|
|
59
|
+
</data>
|
|
60
|
+
</layer>
|
|
61
|
+
</map>
|
|
index 24a01a8..56dfa89 100644
|
|
|
Binary file
|
|
index eb09046..ae3bf2a 100644
|
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|