File: level027.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 (52 lines) | stat: -rw-r--r-- 1,890 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52

import k
from Part import *

def init():
    k.sound.loadTheme('industry')
    k.sound.music()
    k.world.setBackground('level-27')
    
    cx, cy, w, h = k.world.rect.centerx, k.world.rect.centery, k.world.rect.width, k.world.rect.height
    
    # particles
    parts = [ [(cx-w*2/6,  cy+h*2/6), 'blue'],
              [(cx-w*2/6,  cy-h*2/6), 'blue'],
              [(cx+w*2/6,  cy+h*2/6), 'blue'],
              [(cx+w*2/6,  cy-h*2/6), 'blue'],
              [(cx,        cy-h*2/6), 'blue'],
              [(cx,        cy+h*2/6), 'blue'],
              [(cx-w*1/4, cy-h*1/4), 'orange'],
              [(cx-w*1/4, cy+h*1/4), 'orange'],     
              [(cx+w*1/4, cy-h*1/4), 'orange'],
              [(cx+w*1/4, cy+h*1/4), 'orange'],
              [(cx-w*1/8, cy-h*1/4), 'orange'],
              [(cx-w*1/8, cy+h*1/4), 'orange'],     
              [(cx+w*1/8, cy-h*1/4), 'pink'],
              [(cx+w*1/8, cy+h*1/4), 'pink'],
              [(cx-w*1/4, cy-h*1/8), 'pink'],
              [(cx-w*1/4, cy+h*1/8), 'pink'],     
              [(cx+w*1/4, cy-h*1/8), 'pink'],
              [(cx+w*1/4, cy+h*1/8), 'pink'],
              [(cx-w*1/4, cy), 'white'],
              [(cx+w*1/4, cy), 'white'],
              [(cx-w*2/6, cy), 'white'],
              [(cx+w*2/6, cy), 'white'],
              [(cx, cy-h*1/4), 'white'],
              [(cx, cy+h*1/4), 'white'],]
    
    for i in range(len(parts)):
        k.particles.add(Particle({'pos': parts[i][0], 'color': parts[i][1]}))
        
    num = k.config.stage+3    
        
    d = 80
    magnet = [[(cx-d, cy-d), 'orange'],
              [(cx-d, cy+d), 'white'], 
              [(cx+d, cy-d), 'blue'],
              [(cx+d, cy+d), 'pink'],]
    for i in range(len(magnet)):
        k.particles.add(Magnet({'pos':magnet[i][0], 'color': magnet[i][1], 'num': num}))
        
    # simple player
    k.player.setPos((w*0.6,h*0.89))