Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Transition to absolute paths, Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusmoller committed Jan 9, 2014
1 parent 689e833 commit 05f4b61
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion miner/__main__.py
@@ -1,4 +1,4 @@
from engine import GameEngine
from miner.engine import GameEngine

def main():
gameEngine = GameEngine(800, 600)
Expand Down
4 changes: 2 additions & 2 deletions miner/block.py
@@ -1,6 +1,6 @@
import pygame

from constants import *
from miner.constants import *

class BlockSprite(pygame.sprite.Sprite):
def __init__(self, x, y, isResourceRich=False):
Expand Down Expand Up @@ -31,4 +31,4 @@ def draw(self, surface):
surface.blit(self.image, self.rect)

elif self.isBorder:
surface.blit(self.borderImage, self.rect)
surface.blit(self.borderImage, self.rect)
10 changes: 5 additions & 5 deletions miner/engine.py
@@ -1,11 +1,11 @@
import pygame
import time

from menus import *
from player import player
from level import level
from graphics import GraphicsEngine
from constants import *
from miner.menus import *
from miner.player import player
from miner.level import level
from miner.graphics import GraphicsEngine
from miner.constants import *


class GameEngine():
Expand Down
4 changes: 2 additions & 2 deletions miner/gameresource.py
@@ -1,7 +1,7 @@
import pygame
import random

from constants import RESOURCE_MAX_W, RESOURCE_MAX_H, RESOURCE_COLORS, MOVEMENT_SPEED
from miner.constants import RESOURCE_MAX_W, RESOURCE_MAX_H, RESOURCE_COLORS, MOVEMENT_SPEED

class ResourceSprite(pygame.sprite.Sprite):
def __init__(self, x, y):
Expand Down Expand Up @@ -35,4 +35,4 @@ def update(self):
if not self.onGround:
self.yVel = 1

self.rect.y += self.yVel
self.rect.y += self.yVel
10 changes: 5 additions & 5 deletions miner/graphics.py
@@ -1,10 +1,10 @@
import pygame
import random

from player import player
from level import level
from data import filepath
from constants import *
from miner.player import player
from miner.level import level
from miner.data import filepath
from miner.constants import *

class GraphicsEngine():
def __init__(self, surface):
Expand Down Expand Up @@ -110,4 +110,4 @@ def drawPlayerAim(self):
player.targetBlock = (imageRect.x//BLOCK_W, imageRect.y//BLOCK_H)

# draw crosshair
self.screenSurface.blit(self.spriteAim, imageRect)
self.screenSurface.blit(self.spriteAim, imageRect)
8 changes: 4 additions & 4 deletions miner/level.py
Expand Up @@ -2,10 +2,10 @@
import time
import random

from player import player
from block import BlockSprite
from gameresource import ResourceSprite
from constants import BLOCK_W, BLOCK_H, RESOURCE_MAX_W, DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT
from miner.player import player
from miner.block import BlockSprite
from miner.gameresource import ResourceSprite
from miner.constants import BLOCK_W, BLOCK_H, RESOURCE_MAX_W, DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT

class LevelEngine():
def __init__(self):
Expand Down
6 changes: 3 additions & 3 deletions miner/menus.py
@@ -1,8 +1,8 @@
import pygame
import sys

from data import filepath
from constants import *
from miner.data import filepath
from miner.constants import *

# menu object
class MenuClass():
Expand Down Expand Up @@ -379,4 +379,4 @@ def drawHint(self):
textRect = textSurface.get_rect()
textRect.centerx = SCREEN_WIDTH/2
textRect.centery = SCREEN_HEIGHT - 50
self.surface.blit(textSurface, textRect)
self.surface.blit(textSurface, textRect)
4 changes: 2 additions & 2 deletions miner/player.py
@@ -1,6 +1,6 @@
import pygame

from constants import *
from miner.constants import *

class PlayerSprite(pygame.sprite.Sprite):
def __init__(self):
Expand Down Expand Up @@ -84,4 +84,4 @@ def doJump(self):


# define player
player = PlayerSprite()
player = PlayerSprite()
5 changes: 0 additions & 5 deletions run_game.py
@@ -1,9 +1,4 @@
import sys
sys.path.append('miner')

import miner.__main__



if __name__ == "__main__":
miner.__main__.main()

0 comments on commit 05f4b61

Please sign in to comment.