File: level013.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 (32 lines) | stat: -rw-r--r-- 983 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
import k
from levels import *
from Part import *

def init():
    k.sound.loadTheme('industry')
    k.sound.music()
    k.world.setBackground('level-13')

    cx, cy, w, h = k.world.rect.centerx, k.world.rect.centery, k.world.rect.width, k.world.rect.height
    xd = 150
    # 6 white particles
    num = min(6, 2+k.config.stage)    
    k.particles.ballCircle((cx-xd, cy), 'blue', num, 120)
    k.particles.ballCircle((cx+xd, cy), 'white', num, 120, -math.pi)
    
    # 2 magnets 
    k.particles.add (Magnet({'pos': (cx-xd, cy), 'color': 'white', 'num': num}))
    k.particles.add (Magnet({'pos': (cx+xd, cy), 'color': 'blue', 'num': num}))

    # chains
    k.particles.chainCircle((cx, cy), 'white', 4, 100, -math.pi/4)
    
    # anchors
    anchor = [(cx-80, cy),
              (cx+80, cy)]
    for i in range(len(anchor)):
        k.particles.add(Anchor({'pos':anchor[i], 'color': 'white', 'maxLinks': 1}))
        
    # simple player
    k.player.setPos((w/2, cy-3*h/16))