Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

made it work on python3 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions pyray.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
"""
The MIT License (MIT)

Copyright (c) 2013 Oscar Utbult

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
Expand All @@ -22,20 +18,16 @@
THE SOFTWARE.
"""

try:
import math
import time
import pygame
from pygame.locals import *

except ImportError:
print "PyRay could not import necessary modules"
raise ImportError
import math
import time
import pygame
from pygame.locals import *

keys=[False]*324
keys = [False] * 324

# A map over the world
worldMap = [
worldMap = [
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2],
[2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
Expand Down Expand Up @@ -146,13 +138,13 @@ def main():
try:
pygame.image.save(screen,('PyRay' + time.strftime('%Y%m%d%H%M%S')+ '.jpeg'))
except:
print "Couldn't save jpeg screenshot"
print("Couldn't save jpeg screenshot")

if keys[K_F2]:
try:
pygame.image.save(screen,('PyRay' + time.strftime('%Y%m%d%H%M%S')+ '.bmp'))
except:
print "Couldn't save bmp screenshot"
print("Couldn't save bmp screenshot")

# showShadows - On / Off
if keys[K_F5]:
Expand Down Expand Up @@ -264,4 +256,4 @@ def main():
pygame.event.pump()
pygame.display.flip()

main()
main()