Skip to content
Snippets Groups Projects
Commit 648ee048 authored by Sida Wang's avatar Sida Wang :juggling_tone1:
Browse files

load module added, media resources were packed

parent 339ce3c9
No related branches found
No related tags found
No related merge requests found
No preview for this file type
File added
No preview for this file type
File added
No preview for this file type
No preview for this file type
SECTOR_SIZE = 16
def normalize(position):
""" Accepts `position` of arbitrary precision and returns the block
containing that position.
......
from __future__ import division
import time
from block import Block
from view import View
from world import World
from mathModel import *
from algorithms import *
from collections import deque
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key, mouse
import load
import time
import os
import sys
import math
import random
import time
from collections import deque
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key, mouse
#Version Controls
if sys.version_info[0] >= 3:
xrange = range
if sys.version_info[0] * 10 + sys.version_info[1] >= 38:
time.clock = time.process_time
TICKS_PER_SEC = 60
......@@ -38,17 +46,17 @@ JUMP_SPEED = math.sqrt(2 * GRAVITY * MAX_JUMP_HEIGHT)
TERMINAL_VELOCITY = 50
PLAYER_HEIGHT = 2
if sys.version_info[0] >= 3:
xrange = range
if sys.version_info[0] * 10 + sys.version_info[1] >= 38:
time.clock = time.process_time
class Game(pyglet.window.Window):
#Blocks intialization
global BRICK, GRASS, STONE, MARBO
BRICK = load.BRICK
GRASS = load.GRASS
STONE = load.STONE
MARBO = load.MARBO
BRICK = Block((0, 0), (0, 0), (0, 0), 1, os.path.join("texture","Brick.png"))
GRASS = Block((0, 0), (0, 1), (1, 1), 2, os.path.join("texture","Grass.png"))
STONE = Block((0, 0), (0, 0), (0, 0), 1,os.path.join("texture","Stone.png"))
MARBO = Block((0, 0), (0, 0), (0, 0), 1,os.path.join("texture","Marbo.png"))
class Game(pyglet.window.Window):
def __init__(self, *args, **kwargs):
super(Game, self).__init__(*args, **kwargs)
# Whether or not the window exclusively captures the mouse.
......
import os
from block import Block
from pyglet.gl import *
ICON = pyglet.image.load(os.path.join("media","icon.png"))
BUILDSOUND = pyglet.resource.media(os.path.join("media","build.wav"),streaming=False)
DESTROYSOUND = pyglet.resource.media(os.path.join("media",'destroy.wav'),streaming=False)
BACKGROUNDMUSIC = pyglet.resource.media(os.path.join("media",'bgmusic.wav'))
BRICK = Block((0, 0), (0, 0), (0, 0), 1, os.path.join("texture","Brick.png"))
GRASS = Block((0, 0), (0, 1), (1, 1), 2, os.path.join("texture","Grass.png"))
STONE = Block((0, 0), (0, 0), (0, 0), 1, os.path.join("texture","Stone.png"))
MARBO = Block((0, 0), (0, 0), (0, 0), 1, os.path.join("texture","Marbo.png"))
import os
import load
from pyglet.gl import *
from view import View
from game import Game
......@@ -8,15 +9,16 @@ WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
def main():
game = Game(width=WINDOW_WIDTH, height=WINDOW_HEIGHT, caption='MineCraft', resizable=True)
icon = pyglet.image.load("icon.png")
game.buildSound = pyglet.resource.media('build.wav',streaming=False)
game.destroySound = pyglet.resource.media('destroy.wav',streaming=False)
game.backgroundSound = pyglet.resource.media('bgmusic.wav')
game.set_icon(icon)
game = Game(width=WINDOW_WIDTH, height=WINDOW_HEIGHT, caption='CraftMaster', resizable=True)
game.buildSound = load.BUILDSOUND
game.destroySound = load.DESTROYSOUND
game.backgroundMusic = load.BACKGROUNDMUSIC
game.set_icon(load.ICON)
# Hide the mouse cursor and prevent the mouse from leaving the window.
game.set_exclusive_mouse(True)
game.backgroundSound.play()
game.backgroundMusic.play()
pyglet.app.run()
......
File added
File moved
File moved
File moved
File moved
from mathModel import *
from algorithms import *
import sys
import math
......
from mathModel import *
import sys
import math
import random
import time
from algorithms import *
from collections import deque
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key, mouse
#Version Controls
if sys.version_info[0] >= 3:
xrange = range
if sys.version_info[0] * 10 + sys.version_info[1] >= 38:
time.clock = time.process_time
TICKS_PER_SEC = 60
# Size of sectors used to ease block loading.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment