Simplify rand function (time method broken?)

master
GreenXenith 2020-12-26 01:51:57 -08:00
parent c68eee3bee
commit 46c6393f58
3 changed files with 4 additions and 2 deletions

View File

@ -19,4 +19,5 @@ The levels are infinite and persistent. The only limit is your RAM. World resets
## Known Bugs
* Window resizing is mostly broken on Linux. This is a bug in SDL2. Using the maximize button _should_ work most of the time.
* Slimes get stuck in corners. Probably due to the raycaster hitting the corner at the start (rounding issue?).
* Corpses may remove keys and doorways.
* Walls occasionally render improperly. Usually occurs when two rooms are close to each other diagonally.

View File

@ -152,6 +152,7 @@ class Player:
slash.texture.set_animation(0, 3, 5)
# Check for enemies
# This probably shouldnt be handled by the player but whatever
if self.z < len(map.sprites):
for sprite in map.sprites[self.z]:
if sprite.name[:6] == "enemy:":
@ -160,6 +161,7 @@ class Player:
sprite.vel = (sprite.vel * -2) + self.vel + (self.look * 2) # Knockback
if sprite.hp <= 0:
setat = round(sprite.pos)
# BUG: Corpses may remove keys and doorways
map.set_tile(int(setat.x), int(setat.y), int(sprite.z), sprite.name + "_dead")
map.remove_sprite(sprite.id)
drop = rand.rand(0, 7)

View File

@ -1,7 +1,6 @@
# random.randint wrapper
import random
import time
def rand(*args):
random.seed(time.clock())
random.seed()
return random.randint(*args)