Esempio n. 1
0
 def move(self):
     self.position = [
         randNum(0,
                 screen.get_width() / 20 - 1),
         randNum(0,
                 screen.get_height() / 20 - 1)
     ]
     print(self.position)
Esempio n. 2
0
 def __init__(self):
     self.img = pygame.image.load('apple.png')
     self.position = [
         randNum(0,
                 screen.get_width() / 20 - 1),
         randNum(0,
                 screen.get_height() / 20 - 1)
     ]
     self.draw()
Esempio n. 3
0
def getBlockType(blockX, blockY, blockKind): #Defining blocks in the grid
	global entrancePos
	if(blockKind == 'origPath'):
		randBlock = randNum(1,5)
		if(randBlock <= 4): return 'path'
		return 'actionBlock'
	if(blockKind == 'other'):
		if(blockX == 0 or blockX == 13 or blockY == 0 or blockY == 7):
			if(blockY == 7 and randDoor == blockX):
				entrancePos = [randDoor,blockY]
				return 'entrance'
			return 'border'
		randBlock = randNum(1,25)
		if(randBlock <= 9): return 'path'
		if(randBlock > 9 and randBlock < 24): return 'wall'
		return 'actionBlock'
Esempio n. 4
0
def getArt(blockKind):  #Gets the Random Art for that type
    if (blockKind == 'path'):
        randomVar = randNum(1, 4)
        if (randomVar == 1): return 'path'
        if (randomVar == 2): return 'cracked.path'
        if (randomVar == 3): return 'flower.path'
        if (randomVar == 4): return 'crackedFlower.path'
    if (blockKind == 'actionBlock'):
        randomVar = randNum(1, 2)
        if (randomVar == 1): return 'aBlock'
        if (randomVar == 2): return 'flower.aBlock'
    if (blockKind == 'wall' or blockKind == 'border'):
        randomVar = randNum(1, 2)
        if (randomVar == 1): return 'wall'
        if (randomVar == 2): return 'cracked.wall'
    if (blockKind == 'entrance' or blockKind == 'exit'):
        randVar = randNum(1, 2)
        if (randVar == 1): return 'door'
        if (randVar == 2): return 'flower.door'
Esempio n. 5
0
def getDir(entrancePos): #Creating the random path
	global posPath
	print(gameBoard)
	blockX = entrancePos[0]
	blockY = entrancePos[1]
	while(blockY-1 != 0):
		randomVar = randNum(1,3)
		if(randomVar == 1 and gameBoard[blockY-1][blockX][0] != 'border'): #Left
			blockX -= 1
		if(randomVar == 2 and gameBoard[blockY][blockX-1][0] != 'border'): #Up
			blockY -= 1
		if(randomVar == 3 and gameBoard[blockY+1][blockX][0] != 'border'): #Right
			blockX += 1
		posPath.append([blockX, blockY])
	exitPos = [blockX, blockY-1]
	for x in range(len(posPath)):
		gameBoard[[posPath[x][1]posPath[x][0]]] = [getBlockType(posPath[x][1],posPath[x][0],'origPath')]
	gameBoard[exitPos[0]][exitPos[1]] = ['exit']
Esempio n. 6
0
import json
pygame.init()

global white, grey, red, yellow, green, blue
global randDoor, randBlock

#Non-Color Variables
displayWidth = 1400
displayHeight = 800
xBox = 0
yBox = 0
scene = 'startPage'
gameOver = False
imageType = None
firstTime = True
randDoor = randNum(1, 8)
randBlock = randNum(1, 10)
gameBoard = []
entrancePos = []
posPath = []

#Colors
white = (255, 255, 255)
grey = (125, 125, 125)
red = (255, 0, 0)
yellow = (255, 255, 0)
green = (0, 210, 0)
blue = (0, 125, 255)

#Images
startScreen = pygame.transform.scale(
Esempio n. 7
0
pygame.init()

global white, grey, red, yellow, green, blue
global randDoor, randBlock

#Non-Color Variables
displayWidth = 1000
displayHeight = 1000
xBox = 0
yBox = 0
scene = 'startPage'
gameOver = False
imageType = None
firstTime = True
randDoor = 0
randBlock = randNum(1,10)
gameBoard = []
entrancePos = []
posPath = []

#Images
startScreen = pygame.transform.scale(pygame.image.load('gameArt/startScreen.png'),(1000,1000))

playerImg = pygame.transform.scale(pygame.image.load('gameArt/pixelChar.png'), (75, 75))
path = pygame.transform.scale(pygame.image.load('gameArt/path.png'), (100,100))
crackedPath = pygame.transform.scale(pygame.image.load('gameArt/cracked.path.png'), (100,100))
flowerPath = pygame.transform.scale(pygame.image.load('gameArt/flower.path.png'), (100,100))
crackedFlowerPath = pygame.transform.scale(pygame.image.load('gameArt/crackedFlower.path.png'),(100,100))
aBlock = pygame.transform.scale(pygame.image.load('gameArt/aBlock.png'),(100,100))
flowerABlock = pygame.transform.scale(pygame.image.load('gameArt/flower.aBlock.png'),(100,100))
wall = pygame.transform.scale(pygame.image.load('gameArt/wall.png'),(100,100))