File: level016.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 (30 lines) | stat: -rw-r--r-- 957 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

import k
from levels import *
from Part import *

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

    cx, cy, w, h = k.world.rect.centerx, k.world.rect.centery, k.world.rect.width, k.world.rect.height

    num = k.config.stage+2
    
    # particles    
    k.particles.ballCircle((cx, cy), 'blue',  num, w*0.25,  k.config.stage%2 and  math.pi/2)
    k.particles.ballCircle((cx, cy), 'white', num, w*0.17, k.config.stage%2 and -math.pi/2)
    
    # magnets 
    k.particles.add (Magnet({'pos': (  w/4,   h/4), 'color': 'white', 'num': num}))
    k.particles.add (Magnet({'pos': (3*w/4,   h/4), 'color': 'blue',  'num': num}))
    k.particles.add (Magnet({'pos': (  w/4, 3*h/4), 'color': 'blue',  'num': num}))    
    k.particles.add (Magnet({'pos': (3*w/4, 3*h/4), 'color': 'white', 'num': num}))

    # simple player
    yd = [0, -h/12, 0][k.config.stage-1]
    k.player.setPos((w/2, cy+yd))