Compare commits

...

5 Commits

Author SHA1 Message Date
GreenXenith 30a16baab3 Add license 2021-01-29 14:03:44 -08:00
GreenXenith aec7662c0c Change entry point to __main__ 2021-01-29 14:01:20 -08:00
GreenXenith d820dc08c5 Make indentation consistent 2021-01-29 13:55:12 -08:00
GreenXenith 46c6393f58 Simplify rand function (time method broken?) 2020-12-26 01:51:57 -08:00
GreenXenith c68eee3bee Update README 2020-05-02 14:47:38 -07:00
7 changed files with 41 additions and 30 deletions

18
LICENSE.txt Normal file
View File

@ -0,0 +1,18 @@
MIT Copyright 2021 GreenXenith
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,10 +1,23 @@
# Zoria
An RPG Dungeon Crawler using PyGame
Real-time 2.5D RPG Dungeon Crawler using PyGame
## Usage
`python3 zoria.py`
`python3 .`
## Notes
* Features currently only include rendering, map generation, movement, and sprite animation
* `setup.sh` is for git configuration across multiple machines (don't use it)
* `map.json` is not in use. `generator.py` creates maps when loading
## Controls
| Key | Action |
| ------- | --------- |
| `WASD` | Movement |
| `SPACE` | Attack |
| `SHIFT` | Use stair |
## Premise
Each level contains a key and a locked hatch. Collect the key in order to unlock the passage to the next level (`SHIFT` to unlock).
Slimes do minimal damage, but more spawn on each level. They can drop health or XP. More XP = more damage dealt per hit. Coins are currently useless.
The levels are infinite and persistent. The only limit is your RAM. World resets on death.
## 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

@ -1,21 +0,0 @@
#!/bin/bash
printf "Username: "
read NAME
printf "Email: "
read EMAIL
echo "Configuring git..."
git config user.name $NAME
git config user.email $EMAIL
git config credential.username $NAME
git config credential.email $EMAIL
echo "Installing pylint..."
pip3 install pylint
echo "Installing pygame..."
pip3 install pygame

View File

@ -10,7 +10,7 @@ screen = pygame.display.set_mode(winsize, pygame.RESIZABLE)
# Load all assets
from . import assets
for filename in os.listdir(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "assets")):
for filename in os.listdir(os.path.join(os.getcwd(), "assets")):
assets.load(filename)
pygame.display.set_caption("Zoria")

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)