File: level009.py

package info (click to toggle)
krank 0.7%2Bdfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 68,072 kB
  • sloc: python: 3,422; sh: 31; makefile: 11
file content (38 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

import k
from Part import *

def init():
    k.sound.loadTheme('water')
    k.sound.music()
    k.world.setBackground('level-09')

    cx, cy, w, h = k.world.rect.centerx, k.world.rect.centery, k.world.rect.width, k.world.rect.height
    
    # chains
    chains = [(cx, h*1/5),
              (cx, h*4/5),
              (w*1/4, h*1/4),
              (w*1/4, h*3/4),              
              (w*3/4, h*1/4),
              (w*3/4, h*3/4)]
    
    for i in range(len(chains)):
        k.particles.add(Chain({'pos': chains[i], 'color': 'orange'}))
        
    # anchors
    d = 140
    anchor = [(cx-d, cy), (cx+d, cy)]
    for i in range(len(anchor)):
        k.particles.add(Anchor({'pos':anchor[i], 'color': 'orange', 'maxLinks': k.config.stage>=3 and 2 or 1}))
        
    if k.config.stage >= 2:
        k.particles.add(Anchor({'pos': (cx, cy), 'color': 'orange', 'maxLinks': 2}))
        k.particles.ballCircle((cx, cy), 'blue', k.config.stage*2, 70)
        if k.config.stage >= 3:
            k.particles.chainCircle((cx, cy), 'orange', 6, 120, -math.pi/2)
    else:
        k.particles.add(Stone({'pos': (cx, cy), 'color': 'orange'}))
        
    # simple player
    k.player.setPos((cx, h*2/3))