comparison pytouhou/games/pcb.py @ 274:f037bca24f2d

Partially implement lasers. “Launch animations”/“energy circles” are missing, aswell as collision and grazing.
author Thibaut Girka <thib@sitedethib.com>
date Sun, 05 Feb 2012 23:41:55 +0100
parents e59bd7979ddc
children
comparison
equal deleted inserted replaced
273:595b227886b1 274:f037bca24f2d
14 14
15 from pytouhou.utils.interpolator import Interpolator 15 from pytouhou.utils.interpolator import Interpolator
16 16
17 from pytouhou.game.game import Game 17 from pytouhou.game.game import Game
18 from pytouhou.game.bullettype import BulletType 18 from pytouhou.game.bullettype import BulletType
19 from pytouhou.game.bullettype import LaserType
19 from pytouhou.game.itemtype import ItemType 20 from pytouhou.game.itemtype import ItemType
20 from pytouhou.game.player import Player 21 from pytouhou.game.player import Player
21 from pytouhou.game.orb import Orb 22 from pytouhou.game.orb import Orb
22 23
23 from math import pi 24 from math import pi
24 25
25 26
26 class PCBGame(Game): 27 class PCBGame(Game):
27 def __init__(self, resource_loader, player_states, stage, rank, difficulty, **kwargs): 28 def __init__(self, resource_loader, player_states, stage, rank, difficulty,
28 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',)) 29 bullet_types=None, laser_types=None, item_types=None,
29 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) 30 nb_bullets_max=640, width=384, height=448, prng=None):
30 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4), 31 if not bullet_types:
31 BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6), 32 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',))
32 BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4), 33 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',))
33 BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6), 34 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4),
34 BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5), 35 BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6),
35 BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4), 36 BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4),
36 BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16), 37 BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6),
37 BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11), 38 BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5),
38 BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9), 39 BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4),
39 BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32)] 40 BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16),
41 BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11),
42 BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9),
43 BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32)]
40 44
41 item_types = [ItemType(etama3, 0, 7), #Power 45 if not laser_types:
42 ItemType(etama3, 1, 8), #Point 46 laser_types = [] #TODO
43 ItemType(etama3, 2, 9), #Big power 47
44 ItemType(etama3, 3, 10), #Bomb 48 if not item_types:
45 ItemType(etama3, 4, 11), #Full power 49 item_types = [ItemType(etama3, 0, 7), #Power
46 ItemType(etama3, 5, 12), #1up 50 ItemType(etama3, 1, 8), #Point
47 ItemType(etama3, 6, 13)] #Star 51 ItemType(etama3, 2, 9), #Big power
52 ItemType(etama3, 3, 10), #Bomb
53 ItemType(etama3, 4, 11), #Full power
54 ItemType(etama3, 5, 12), #1up
55 ItemType(etama3, 6, 13)] #Star
48 56
49 players = [PCBPlayer(state, self, resource_loader) for state in player_states] 57 players = [PCBPlayer(state, self, resource_loader) for state in player_states]
50 58
51 Game.__init__(self, resource_loader, players, stage, rank, difficulty, 59 Game.__init__(self, resource_loader, players, stage, rank, difficulty,
52 bullet_types, item_types, nb_bullets_max=640, **kwargs) 60 bullet_types, laser_types, item_types, nb_bullets_max,
61 width, height, prng)
53 62
54 63
55 64
56 class PCBPlayer(Player): 65 class PCBPlayer(Player):
57 def __init__(self, state, game, resource_loader): 66 def __init__(self, state, game, resource_loader):