forked from suncat/magictower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snakes.py
84 lines (71 loc) · 2.07 KB
/
snakes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# coding:utf8
from __future__ import absolute_import
import pygame
from consts import CELL_SIZE
from npc import Npc
from doors import Switchdoor
from dprocks import Largedprock
from drugs import Middledrug
from keys import BlueKey
from msgbox import Msgbox
from enemy import Enemy
from character import load_images
class Snake(Enemy):
images = load_images(["snake.png", "snake2.png"])
_hp = 10
money = 1
exp = 1
feature = 'None'
skill = "NO"
condition = "NORMAL"
@classmethod
def hp(cls, player):
return max(cls._hp - player.snakerocknum * 13, 0)
class MiddleSnake(Snake):
images = load_images(["middlesnake.png", "middlesnake2.png"])
_hp = 105
money = 4
exp = 3
feature = 'None'
skill = "NO"
condition = "NORMAL"
class LargeSnake(Snake):
images = load_images(["largesnake.png", "largesnake2.png"])
_hp = 280
money = 8
exp = 8
feature = 'None'
skill = "NO"
condition = "NORMAL"
class MagicSnake(Snake):
images = load_images(["magicsnake.png", "magicsnake2.png"])
_hp = 300
money = 9
exp = 8
feature = 'None'
skill = "NO"
condition = "NORMAL"
class KingSnake(Snake):
images = load_images(["kingsnake.png", "kingsnake2.png"])
_hp = 350
money = 10
exp = 10
first_ften = True
feature = 'None'
skill = "NO"
condition = "NORMAL"
def do_collide(self, player):
super(KingSnake, self).do_collide(player)
for sprite in player.currentfloor.group:
if isinstance(sprite, Switchdoor):
sprite.kill()
player.currentfloor.group.add(
Largedprock((3.5 * CELL_SIZE, 3.5 * CELL_SIZE)),
Largedprock((4.5 * CELL_SIZE, 3.5 * CELL_SIZE)),
Middledrug((3.5 * CELL_SIZE, 4.5 * CELL_SIZE)),
Middledrug((4.5 * CELL_SIZE, 4.5 * CELL_SIZE)),
BlueKey((3.5 * CELL_SIZE, 5.5 * CELL_SIZE)),
BlueKey((4.5 * CELL_SIZE, 5.5 * CELL_SIZE))
)
if player.health > 0:
Msgbox("No!!! How can you kill me! How can you be so terrible!").show()