annotate pytouhou/game/games.py @ 151:5cf927cbd9c5

Merge GameState into Game. TODO: Merge PlayerState into Player
author Thibaut Girka <thib@sitedethib.com>
date Tue, 04 Oct 2011 23:32:02 +0200
parents 4f46717390aa
children 37df8c618c2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
122
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
1 # -*- encoding: utf-8 -*-
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
2 ##
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
3 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com>
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
4 ##
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
5 ## This program is free software; you can redistribute it and/or modify
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
6 ## it under the terms of the GNU General Public License as published
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
7 ## by the Free Software Foundation; version 3 only.
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
8 ##
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
9 ## This program is distributed in the hope that it will be useful,
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
12 ## GNU General Public License for more details.
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
13 ##
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
14
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
15 from pytouhou.game.game import Game
130
11ab06f4c4c6 Introduce characters!
Thibaut Girka <thib@sitedethib.com>
parents: 122
diff changeset
16 from pytouhou.game.character import Character
122
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
17 from pytouhou.game.bullettype import BulletType
150
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
18 from pytouhou.game.itemtype import ItemType
122
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
19
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
20 class EoSDGame(Game):
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
21 def __init__(self, resource_loader, players, stage, rank, difficulty):
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
22 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',))
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
23 etama4 = resource_loader.get_anm_wrapper(('etama4.anm',))
139
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
24 bullet_types = [BulletType(etama3, 0, 11, 14, 15, 16, hitbox_size=4),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
25 BulletType(etama3, 1, 12, 17, 18, 19, hitbox_size=6),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
26 BulletType(etama3, 2, 12, 17, 18, 19, hitbox_size=4),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
27 BulletType(etama3, 3, 12, 17, 18, 19, hitbox_size=6),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
28 BulletType(etama3, 4, 12, 17, 18, 19, hitbox_size=5),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
29 BulletType(etama3, 5, 12, 17, 18, 19, hitbox_size=4),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
30 BulletType(etama3, 6, 13, 20, 20, 20, hitbox_size=16),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
31 BulletType(etama3, 7, 13, 20, 20, 20, hitbox_size=11),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
32 BulletType(etama3, 8, 13, 20, 20, 20, hitbox_size=9),
3af65541dfd3 Add EoSD's hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 138
diff changeset
33 BulletType(etama4, 0, 1, 2, 2, 2, hitbox_size=32)]
150
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
34 item_types = [ItemType(etama3, 0, 7, speed=8., hitbox_size=42), #TODO: hitbox
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
35 ItemType(etama3, 1, 8, speed=8., hitbox_size=42), #TODO: hitbox
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
36 ItemType(etama3, 2, 9, speed=8., hitbox_size=42), #TODO: hitbox
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
37 ItemType(etama3, 3, 10, speed=8., hitbox_size=42), #TODO: hitbox
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
38 ItemType(etama3, 4, 11, speed=8., hitbox_size=42), #TODO: hitbox
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
39 ItemType(etama3, 5, 12, speed=8., hitbox_size=42), #TODO: hitbox
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
40 ItemType(etama3, 6, 13, speed=8., hitbox_size=42)] #TODO: hitbox
122
174324a4da51 Add support for launch animations! (Warning: slow :()
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
41
130
11ab06f4c4c6 Introduce characters!
Thibaut Girka <thib@sitedethib.com>
parents: 122
diff changeset
42 player00 = resource_loader.get_anm_wrapper(('player00.anm',))
11ab06f4c4c6 Introduce characters!
Thibaut Girka <thib@sitedethib.com>
parents: 122
diff changeset
43 player01 = resource_loader.get_anm_wrapper(('player01.anm',))
138
429de58498f9 Fix player hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 130
diff changeset
44 characters = [Character(player00, 4., 2., 2.5),
429de58498f9 Fix player hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 130
diff changeset
45 Character(player00, 4., 2., 2.5),
429de58498f9 Fix player hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 130
diff changeset
46 Character(player01, 5., 2.5, 2.5),
429de58498f9 Fix player hitboxes
Thibaut Girka <thib@sitedethib.com>
parents: 130
diff changeset
47 Character(player01, 5., 2.5, 2.5)]
130
11ab06f4c4c6 Introduce characters!
Thibaut Girka <thib@sitedethib.com>
parents: 122
diff changeset
48
11ab06f4c4c6 Introduce characters!
Thibaut Girka <thib@sitedethib.com>
parents: 122
diff changeset
49 Game.__init__(self, resource_loader, players, stage, rank, difficulty,
150
4f46717390aa Introduce items, implement ECL instruction 83
Thibaut Girka <thib@sitedethib.com>
parents: 143
diff changeset
50 bullet_types, item_types, characters, nb_bullets_max=640)
130
11ab06f4c4c6 Introduce characters!
Thibaut Girka <thib@sitedethib.com>
parents: 122
diff changeset
51