comparison pytouhou/games/eosd.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 8fa660da5f0c
children 4838e9bab0f9
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.lasertype 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
25 26
26 SQ2 = 2. ** 0.5 / 2. 27 SQ2 = 2. ** 0.5 / 2.
27 28
28 29
29 class EoSDGame(Game): 30 class EoSDGame(Game):
30 def __init__(self, resource_loader, player_states, stage, rank, difficulty, **kwargs): 31 def __init__(self, resource_loader, player_states, stage, rank, difficulty,
31 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',)) 32 bullet_types=None, laser_types=None, item_types=None,
32 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) 33 nb_bullets_max=640, width=384, height=448, prng=None):
33 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4),
34 BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6),
35 BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4),
36 BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6),
37 BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5),
38 BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4),
39 BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16),
40 BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11),
41 BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9),
42 BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32)]
43 34
44 item_types = [ItemType(etama3, 0, 7), #Power 35 if not bullet_types:
45 ItemType(etama3, 1, 8), #Point 36 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',))
46 ItemType(etama3, 2, 9), #Big power 37 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',))
47 ItemType(etama3, 3, 10), #Bomb 38 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4),
48 ItemType(etama3, 4, 11), #Full power 39 BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6),
49 ItemType(etama3, 5, 12), #1up 40 BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4),
50 ItemType(etama3, 6, 13)] #Star 41 BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6),
42 BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5),
43 BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4),
44 BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16),
45 BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11),
46 BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9),
47 BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32)]
48
49 if not laser_types:
50 laser_types = [LaserType(etama3, 9),
51 LaserType(etama3, 10)]
52
53 if not item_types:
54 item_types = [ItemType(etama3, 0, 7), #Power
55 ItemType(etama3, 1, 8), #Point
56 ItemType(etama3, 2, 9), #Big power
57 ItemType(etama3, 3, 10), #Bomb
58 ItemType(etama3, 4, 11), #Full power
59 ItemType(etama3, 5, 12), #1up
60 ItemType(etama3, 6, 13)] #Star
51 61
52 characters = resource_loader.get_eosd_characters() 62 characters = resource_loader.get_eosd_characters()
53 players = [EoSDPlayer(state, self, resource_loader, characters[state.character]) for state in player_states] 63 players = [EoSDPlayer(state, self, resource_loader, characters[state.character]) for state in player_states]
54 64
55 Game.__init__(self, resource_loader, players, stage, rank, difficulty, 65 Game.__init__(self, resource_loader, players, stage, rank, difficulty,
56 bullet_types, item_types, nb_bullets_max=640, **kwargs) 66 bullet_types, laser_types, item_types, nb_bullets_max,
67 width, height, prng)
57 68
58 69
59 70
60 class EoSDPlayer(Player): 71 class EoSDPlayer(Player):
61 def __init__(self, state, game, resource_loader, character): 72 def __init__(self, state, game, resource_loader, character):