Mercurial > skaapsteker
annotate skaapsteker/sprites/projectiles.py @ 430:25efc74ac19c
Hook up flight and invisibility discharge
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 09 Apr 2011 18:40:25 +0200 |
parents | 64d8e49e9a86 |
children | c1b0ad1c0932 |
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 |
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
|
7 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
|
8 |
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 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
|
10 |
342 | 11 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
|
12 animation_regexes = [ |
346
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
13 ("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
|
14 ] |
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
|
15 |
346
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
16 facings = { |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
17 "raining_death" : ( |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
18 ('left', None), |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
19 ('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
|
20 } |
077f43eb4145
Hook up smaller fireball images. Set fireball facing.
Simon Cross <hodgestar@gmail.com>
parents:
342
diff
changeset
|
21 |
366 | 22 PROJECTILE_SIZE = (55, 8) # pixels |
362 | 23 VELOCITY = (300, -1000) # pps |
355
5bdb4677510a
Have fireballs appear in the right place.
Simon Cross <hodgestar@gmail.com>
parents:
346
diff
changeset
|
24 |
366 | 25 |
26 class Lightning(Projectile): | |
27 | |
28 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
|
29 friction_coeff = (1.2, 1.2) # negative friction |
366 | 30 |
389
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
31 image_dir = 'sprites/attacks' |
366 | 32 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
|
33 ('frightening', r"^lightning.png$"), |
366 | 34 ] |
35 | |
36 facings = { | |
37 "frightening" : ( | |
38 ('left', None), | |
39 ('right', lambda x: transform.flip(x, True, False))), | |
40 } | |
41 | |
42 PROJECTILE_SIZE = (55, 8) # pixels | |
43 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
|
44 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
45 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
46 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
|
47 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
48 gravitates = False |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
49 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
|
50 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
51 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
|
52 animation_regexes = [ |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
53 ('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
|
54 ] |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
55 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
56 facings = { |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
57 "frightening" : ( |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
58 ('left', None), |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
59 ('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
|
60 } |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
61 |
64d8e49e9a86
Hook up images for lightning and energy drain. Given lightning negative friction.
Simon Cross <hodgestar@gmail.com>
parents:
366
diff
changeset
|
62 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
|
63 VELOCITY = (400, 0) # pps |