forked from InfoProjekt/game
Compare commits
No commits in common. "1f38a04004390716da2bc847176792e1a6962d8f" and "4d228bf6e0776572262c3b91a6ffe82a06eff84f" have entirely different histories.
1f38a04004
...
4d228bf6e0
2 changed files with 8 additions and 27 deletions
|
|
@ -243,7 +243,7 @@ class Room(GameObjects):
|
||||||
self.locked = True
|
self.locked = True
|
||||||
else:
|
else:
|
||||||
self.locked = False
|
self.locked = False
|
||||||
[self.objects[4].append(wall) for wall in self.genWalls(WIDTH, HEIGHT)]
|
[self.objects[3].append(wall) for wall in self.genWalls(WIDTH, HEIGHT)]
|
||||||
|
|
||||||
def genWalls(self, WIDTH, HEIGHT):
|
def genWalls(self, WIDTH, HEIGHT):
|
||||||
walls = []
|
walls = []
|
||||||
|
|
|
||||||
29
viecher.py
29
viecher.py
|
|
@ -150,7 +150,6 @@ class MainCharacter(Fighter):
|
||||||
if touches is not None and not isinstance(touches, Weapons):
|
if touches is not None and not isinstance(touches, Weapons):
|
||||||
if isinstance(touches, Obstacle):
|
if isinstance(touches, Obstacle):
|
||||||
if not touches.collision:
|
if not touches.collision:
|
||||||
print(touches.name)
|
|
||||||
return
|
return
|
||||||
if touches.type == 'wall':
|
if touches.type == 'wall':
|
||||||
if touches.name == 'wall_l':
|
if touches.name == 'wall_l':
|
||||||
|
|
@ -163,18 +162,18 @@ class MainCharacter(Fighter):
|
||||||
self.y -= (2 + self.rect.height - (touches.rect.y - self.y))
|
self.y -= (2 + self.rect.height - (touches.rect.y - self.y))
|
||||||
return
|
return
|
||||||
elif isinstance(touches, NPC):
|
elif isinstance(touches, NPC):
|
||||||
if keys[pg.K_f]:
|
if keys[pg.K_SPACE]:
|
||||||
touches.talk(objects)
|
touches.talk(objects)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.x <= touches.rect.x: self.x -= (self.rect.width - (touches.rect.x - self.x))
|
if self.x <= touches.rect.x: self.x -= (self.rect.width - (touches.rect.x - self.x))
|
||||||
elif self.x > touches.rect.x: self.x += (self.rect.width - (self.x - touches.rect.x - touches.rect.width * 0.66))
|
elif self.x > touches.rect.x: self.x += (self.rect.width - (self.x - touches.rect.x))
|
||||||
#if self.y <= touches.y: pass
|
#if self.y <= touches.y: pass
|
||||||
#elif self.y > touches.y: pass
|
#elif self.y > touches.y: pass
|
||||||
#self.x -= moveto[0] * 2 / fps
|
self.x -= moveto[0] * 2 / fps
|
||||||
#self.y -= moveto[1] * 2 / fps
|
self.y -= moveto[1] * 2 / fps
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if self.x <= 32:
|
if self.x <= 32:
|
||||||
|
|
@ -202,7 +201,7 @@ class MainCharacter(Fighter):
|
||||||
def update(self, keys, mouse, objects):
|
def update(self, keys, mouse, objects):
|
||||||
if not self.talking:
|
if not self.talking:
|
||||||
self.walk(keys, objects)
|
self.walk(keys, objects)
|
||||||
if pg.mouse.get_pressed()[0]:
|
if keys[pg.K_f]:
|
||||||
self.attack(objects, vec(mouse))
|
self.attack(objects, vec(mouse))
|
||||||
self.speech.update(self)
|
self.speech.update(self)
|
||||||
if self.health.health <= 0:
|
if self.health.health <= 0:
|
||||||
|
|
@ -318,7 +317,6 @@ class Book():
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Mobs(Fighter):
|
class Mobs(Fighter):
|
||||||
def __init__(self, name, ms, sprite, x, y, health, damage, level, asp, atr, drops) -> None:
|
def __init__(self, name, ms, sprite, x, y, health, damage, level, asp, atr, drops) -> None:
|
||||||
super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr)
|
super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr)
|
||||||
|
|
@ -332,23 +330,6 @@ class Mobs(Fighter):
|
||||||
moveto.scale_to_length(self.speed)
|
moveto.scale_to_length(self.speed)
|
||||||
self.x += moveto[0] / fps
|
self.x += moveto[0] / fps
|
||||||
self.y += moveto[1] / fps
|
self.y += moveto[1] / fps
|
||||||
touches = pg.sprite.spritecollideany(self, obj[4])
|
|
||||||
if touches is not None and not isinstance(touches, Weapons):
|
|
||||||
if isinstance(touches, Obstacle):
|
|
||||||
if not touches.collision:
|
|
||||||
return
|
|
||||||
if touches.type == 'wall':
|
|
||||||
if touches.name == 'wall_l':
|
|
||||||
self.x += (2 + (self.x - touches.rect.x))
|
|
||||||
elif touches.name == 'wall_r':
|
|
||||||
self.x -= (2 + self.rect.width - (touches.rect.x - self.x))
|
|
||||||
if touches.name == 'wall_t':
|
|
||||||
self.y += (2 + (self.y - touches.rect.y))
|
|
||||||
elif touches.name == 'wall_b':
|
|
||||||
self.y -= (2 + self.rect.height - (touches.rect.y - self.y))
|
|
||||||
|
|
||||||
if self.x <= touches.rect.x: self.x -= (self.rect.width - (touches.rect.x - self.x))
|
|
||||||
elif self.x > touches.rect.x: self.x += (self.rect.width - (self.x - touches.rect.x - touches.rect.width * 0.66))
|
|
||||||
else:
|
else:
|
||||||
self.attack(moveto, obj)
|
self.attack(moveto, obj)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue