Mercurial > skaapsteker
annotate skaapsteker/sprites/projectiles.py @ 630:2707b33cbcb7
Unbreak breakable items
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Wed, 29 Jun 2011 18:30:50 +0200 |
parents | c1b0ad1c0932 |
children |
rev | line source |
---|---|
336
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
1 """Things people throw at each other.""" |
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
2 |
346
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
3 from pygame import transform |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
4 |
342 | 5 from .base import Projectile |
336
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
6 |
538
c1b0ad1c0932
Hook up projectile sounds.
Simon Cross <hodgestar@gmail.com>
parents:
389
diff
changeset
|
7 |
336
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
8 class Fireball(Projectile): |
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
9 |
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
10 gravitates = True |
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
11 |
538
c1b0ad1c0932
Hook up projectile sounds.
Simon Cross <hodgestar@gmail.com>
parents:
389
diff
changeset
|
12 launch_sound = 'sounds/woosh fireball.ogg', 0.5 |
342 | 13 image_dir = 'sprites/attacks/fireball' |
336
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
14 animation_regexes = [ |
346
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
15 ("raining_death", r"^fireball-\d+-sm.png$"), |
336
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
16 ] |
c8fd82ff0c71
Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
Simon Cross <hodgestar@gmail.com>
parents:
diff
changeset
|
17 |
346
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
18 facings = { |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
19 "raining_death" : ( |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
20 ('left', None), |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
21 ('right', lambda x: transform.flip(x, True, False))), |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
22 } |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
23 |
366 | 24 PROJECTILE_SIZE = (55, 8) # pixels |
362 | 25 VELOCITY = (300, -1000) # pps |
355
5bdb4677510a
Have fireballs appear in the right place.
Simon Cross <hodgestar@gmail.com>
parents:
346
diff
changeset
|
26 |
366 | 27 |
28 class Lightning(Projectile): | |
29 | |
30 gravitates = False | |
389
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
31 friction_coeff = (1.2, 1.2) # negative friction |
366 | 32 |
538
c1b0ad1c0932
Hook up projectile sounds.
Simon Cross <hodgestar@gmail.com>
parents:
389
diff
changeset
|
33 launch_sound = 'sounds/lightning.ogg', 0.25 |
389
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
34 image_dir = 'sprites/attacks' |
366 | 35 animation_regexes = [ |
389
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
36 ('frightening', r"^lightning.png$"), |
366 | 37 ] |
38 | |
39 facings = { | |
40 "frightening" : ( | |
41 ('left', None), | |
42 ('right', lambda x: transform.flip(x, True, False))), | |
43 } | |
44 | |
45 PROJECTILE_SIZE = (55, 8) # pixels | |
46 VELOCITY = (400, 0) # pps | |
389
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
47 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
48 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
49 class EnergyDrain(Projectile): |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
50 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
51 gravitates = False |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
52 friction_coeff = (1.0, 1.0) # no friction |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
53 |
538
c1b0ad1c0932
Hook up projectile sounds.
Simon Cross <hodgestar@gmail.com>
parents:
389
diff
changeset
|
54 launch_sound = 'sounds/woosh.ogg', 0.5 |
389
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
55 image_dir = 'sprites/attacks' |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
56 animation_regexes = [ |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
57 ('draining', r"^energy_drain.png$"), |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
58 ] |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
59 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
60 facings = { |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
61 "frightening" : ( |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
62 ('left', None), |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
63 ('right', lambda x: transform.flip(x, True, False))), |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
64 } |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
65 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
66 PROJECTILE_SIZE = (55, 8) # pixels |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
67 VELOCITY = (400, 0) # pps |