Skip to content

Commit 635ec04

Browse files
authored
Add files via upload
Adding boss and item files
1 parent 16c82fa commit 635ec04

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

Thelda/bosses.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
from thumby import Sprite, display
2+
import gc
3+
from sys import path
4+
path.append("/Games/Thelda")
5+
from random import choice, randrange, randint
6+
7+
8+
class Aquamentus:
9+
def __init__(self, x, y, identity):
10+
self.identity = identity
11+
self.enemy_type = "aquamentus"
12+
self.x = x
13+
self.y = y
14+
self.damage = 1
15+
self.starting_health = 6
16+
self.health = 6
17+
self.frozen = False
18+
self.is_dead = False
19+
self.attack_speed = 199
20+
self.magic = []
21+
self.prespawn = False
22+
self.walk_distance = 0
23+
self.direction = -1
24+
self.blank_map = bytearray([255,255,255,255,255,255,255,255,255,255,
25+
3,3,3,3,3,3,3,3,3,3])
26+
self.prespawn_map = bytearray([25,233,242,252,224,222,95,219,231,15,
27+
3,0,1,2,2,2,2,0,1,2])
28+
self.prespawn_mask = bytearray([230,246,255,255,255,225,224,228,248,240,
29+
0,1,3,1,1,1,1,3,3,1])
30+
self.has_fired = False
31+
self.pick_new_direction_and_distance()
32+
self.move_tick = 0
33+
self.spawn_animation_counter = 0
34+
35+
def pick_new_direction_and_distance(self):
36+
self.direction = choice([-1, 1])
37+
self.walk_distance = randint(1, 6)
38+
self.target_x = self.x + self.direction * self.walk_distance
39+
if self.direction == -1:
40+
self.target_x = max(35, self.target_x)
41+
else:
42+
self.target_x = min(55, self.target_x)
43+
44+
def move(self):
45+
# Move every 4 ticks
46+
if self.move_tick == 0:
47+
if self.direction == -1:
48+
self.x = max(35, self.x - 1)
49+
else:
50+
self.x = min(55, self.x + 1)
51+
52+
if self.x == self.target_x or (self.direction == -1 and self.x == 35) or (self.direction == 1 and self.x == 55):
53+
self.pick_new_direction_and_distance()
54+
55+
self.move_tick = (self.move_tick + 1) % 4
56+
57+

Thelda/items.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from thumby import Sprite
2+
3+
class Heart_Container:
4+
def __init__(self, x, y, identity):
5+
self.x = x
6+
self.y = y
7+
self.identity = identity
8+
self.item_type = "heartcontainer"
9+
self.item = bytearray([25,22,13,22,25])
10+
# self.item_mask = bytearray([6,15,30,15,6])
11+
self.sprite = Sprite(5, 5, self.item, self.x, self.y, key=1)

0 commit comments

Comments
 (0)