Example #1
0
    def __init__(self, *args, **kwargs):
        global manager
        spyral.Scene.__init__(self, SIZE)
        model.loadResources()
        self.background = model.resources["background"]
        
        startText = drawFont(self.scene, "Extras/Comic_Book.ttf", "FACEOFF")
        startText.pos = (WIDTH/4, 10)

        drawButton(self, "Extras/startButton.png", WIDTH/2, HEIGHT*3/5, "start")
        drawButton(self, "Extras/loadButton.png", WIDTH/2, HEIGHT*4/5, "loadgame")

        spyral.event.register("system.quit", spyral.director.pop)
    def __init__(self, q, diff):
        super(mainScreen, self).__init__(SIZE)
        model.loadResources()
        self.background = model.resources["background"]
        self.layers = ['bot', 't']
        self.q = q
        print str(q.answer) + ' ' + str(q.randomNumOne) + ' ' + str(q.randomNumTwo)
        self.answer = q.answer
        self.board = ironBoard(self,diff, q.randomNumTwo)
        self.board.pos = (WIDTH/4,3*HEIGHT/4.0)
        self.hammer = ironHammer(self, q.randomNumOne)
        self.hammer.pos = (WIDTH/7.5,HEIGHT/4.5)
        self.correct = False

        text1 = drawFont(self, "Use the hammer to crush the numbers that can", spyral.Font(FONT, 30, WHITE))
        text1.pos = (WIDTH/2, 0)
        text1.anchor = 'midtop'
        text2 = drawFont(self, "be divided by the number on the hammer!", spyral.Font(FONT, 30, WHITE))
        text2.pos = (WIDTH/2, text1.height + 10)
        text2.anchor = 'midtop'
        text3 = drawFont(self, "Answer: ", spyral.Font(FONT, 30, WHITE))
        text3.pos = (WIDTH/2 - 100, HEIGHT - 50)
        text3.anchor = 'midbottom'
        
        idkwhatthefuckamidoing = 1 if q.randomNumTwo % 1 > 0 else 0
        dividend = drawFont(self, "Dividend: " + str(int(self.board.denom)/pow(10.0,idkwhatthefuckamidoing)), spyral.Font(FONT, 30, WHITE))
        dividend.pos = (WIDTH/2, HEIGHT - 80)
        dividend.anchor = 'midbottom'

        helpText = drawFont(self, "Right Arrow: Move Right     Down Arrow: Hammer Time", spyral.Font(FONT, 30, WHITE))
        helpText.pos = (WIDTH/2, HEIGHT - 10)
        helpText.anchor = 'midbottom'

        self.numHam = []

        for i in range(1,6):
            numham = drawFont(self, '', spyral.Font(FONT, 30, (255,255,255)))
            numham.anchor = 'midbottom'
            numham.pos = (WIDTH/3 + 50 + (i * WIDTH/20.0), HEIGHT - 50)
            numham.layer = 't'
            self.numHam.append(numham)
        if self.answer%1 > 0:
            dot = drawFont(self, '.', spyral.Font(FONT, 30, (255,255,255)))
            dot.pos = (WIDTH/3 + 50 + (4.5 * WIDTH/20.0), HEIGHT - 50)
            dot.anchor = 'midbottom'
            dot.layer = 't'

        #Scene pop wait time
        self.popwait = 50
        self.popt = 0
Example #3
0
	def __init__(self, q, difficulty):
		super(DivisionScreen, self).__init__(SIZE)
		model.loadResources()
		self.difficulty = DIFFICULTY[difficulty]
		self.background = spyral.Image(size=SIZE)
		self.background.fill((0,0,0))
		self.question = q
		self.numerator = self.question.randomNumTwo
		self.divisor = self.question.randomNumOne
		self.answer = 0

		spyral.event.register("director.update", self.Update)
		spyral.event.register("input.keyboard.down.return", self.Return)

		self.floors = []
		self.boxes = []
		self.texts = []

		self.answerText = drawFont(self, " Goal: " + str(self.numerator), spyral.Font(FONT, 30, (255,255,255)))
		self.weightText = drawFont(self, " Box Weight: " + str(self.divisor), spyral.Font(FONT, 30, (255,255,255)))
		self.weightText.pos = (self.answerText.width, 0)
		self.currentText = drawFont(self, " Current: ", spyral.Font(FONT, 30, (255,255,255)))
		self.currentText.pos = (self.answerText.width + self.weightText.width + 10, 0)

		for f in range(1, 4):
			length = 19 if self.difficulty > 0 else 10
			modifier = -9 if self.difficulty > 0 else 0
			scalar = (WIDTH/length, HEIGHT/32)
			floor = []
			for i in range(0, length):
				floormat = BoatFloor(self)
				floormat.setNumber(2 - f, i + modifier)
				floormat.pos = (i * WIDTH/length, f * HEIGHT/3 - floormat.image.height)
				floor.append(floormat)
				t = drawFont(self, str(floormat.num), spyral.Font(FONT, 15, (255,255,255)))
				t.pos = (floormat.pos[0], floormat.pos[1] - floormat.image.height)
				self.texts.append(t)
			self.floors.append(floor)

		for i in range(1, 4):
			box = Box(self, self.divisor)
			box.pos = (WIDTH/19 * 9 + box.width/2 if self.difficulty > 0 else 0 + box.width/2,
				        self.floors[i - 1][0].pos[1] - HEIGHT/22)
			box.floor = i - 1
			self.boxes.append(box)

		self.man = Man(self)
		self.man.pos = (WIDTH/19, self.floors[self.man.floor][0].pos[1] - HEIGHT/16)
Example #4
0
	def __init__(self, result, answer):
		super(resultScreen, self).__init__(SIZE)
		model.loadResources()
		self.layers = ['bottom','top']
		self.result = result
		self.timer = 0
		self.background = spyral.Image(size=SIZE)
		self.background.fill((193,255,255))
		spyral.event.register("director.update", self.Update)
		self.ship = Boat(self)
		self.ship.layer = 'bottom'
		self.ship.pos = (WIDTH/2, HEIGHT/7 * 6)
		self.shipangle = math.pi/(8.0 if answer > 0 else -8.0)
		self.ship.angle = self.shipangle
		self.sea = Sea(self)
		self.sea.pos = (0, HEIGHT/3 * 2)
		self.sea.layer = 'top'
		self.correct = (result == 0)
Example #5
0
	def __init__(self, q, difficulty):
		super(sinkingScreen, self).__init__(SIZE)
		model.loadResources()
		self.q = q
		self.difficulty = difficulty
		spyral.event.register("director.update", self.Update)
		self.timer = 0
		self.background = spyral.Image(size=SIZE)
		self.background.fill((193,255,255))
		
		self.ship = Boat(self)
		self.ship.pos = (WIDTH/2, HEIGHT/7 * 6)
		self.shipangle = 8.0 if self.q.answer > 0 else -8.0
		self.ship.angle = math.pi/self.shipangle

		self.sea = Sea(self)
		self.sea.pos = (0, HEIGHT/3 * 2)

		self.layers = ['top','bottom']
	def __init__(self, q, difficulty):
		super(mainScreen, self).__init__(SIZE)
		model.loadResources()
		self.background = model.resources["background"]
		self.cam = camera(self, q)
		self.cam.pos = (WIDTH/2, self.cam.pos[1])
		self.camy = self.cam.pos[1]
		self.steve = Steve(self)
		self.q = q
		self.choose = False #for comparison only
		self.correct = False #initial
		self.dreg = False

		print self.q.randomNumOne
		print self.q.randomNumTwo

		self.countdown = drawFont(self, "Ready!", spyral.Font(FONT,WIDTH/30,WHITE))
		self.countdown.anchor = 'midtop'
		self.countdown.pos = (WIDTH/2, 40)
		self.count = 0
		self.hint = drawFont(self, "Hint: Whatever falls on the right is greater", spyral.Font(FONT,WIDTH/40,WHITE))
		self.hint.anchor = 'midbottom'
		self.hint.pos = (WIDTH/2, HEIGHT - 20)
		self.ballimage =[]
		self.ballpointers = []
		ballpointer = drawFont(self, "", spyral.Font(FONT, WIDTH/30, WHITE))
		ballpointer.visible = False
		ballpointer.anchor = 'center'
		self.ballpointers.append(ballpointer)
		self.offtime = 0
		
		if q.qtype == "compare":
			ball2pointer = drawFont(self, "", spyral.Font(FONT, WIDTH/30, WHITE))
			ball2pointer.visible = False
			ball2pointer.anchor = 'center'
			self.ballpointers.append(ball2pointer)
		
		self.selector = drawFont(self, " ", spyral.Font(FONT, WIDTH/120, WHITE))
		self.selector.pos = (WIDTH/2, self.countdown.y + WIDTH/40 + WIDTH/10)
		self.selector.anchor = "center"
		spyral.event.register("director.update", self.update)
    def __init__(self, q, diff):
        super(mainScene, self).__init__(SIZE)
        model.loadResources();
        self.background = model.resources["background"]
        self.diff = diff        
        self.answer = q.answer
        self.firstnum = max(q.randomNumOne, q.randomNumTwo)
        self.secondnum = min(q.randomNumOne, q.randomNumTwo)
        self.borrower = Borrower(self, diff)
        self.deakers = []
        self.layers = ['beakerp','break']
        self.subFrom = []
        self.subBy = []
        self.filllist = [0,0,0]
        self.text1 = drawFont(self,"We need the perfect mixture to fuel us to victory!", spyral.Font(FONT, 25, WHITE))
        self.text2 = drawFont(self,"We have " + str(self.firstnum) + " pebbles but we only need " + str(self.secondnum) +"! Place what we need back in the beakers!", spyral.Font(FONT, 25, WHITE))
        self.text3 = drawFont(self,"Fill in the beakers but do not overflow them!",spyral.Font(FONT,25,WHITE))
        self.text4 = drawFont(self,"Down: Fill up the beaker       Space : Lend the pebble to the right", spyral.Font(FONT,25,WHITE))
        self.text1.pos = (WIDTH/6 + 25, 0)
        self.text2.pos = (25, self.text1.height + self.text1.pos.y)		
        self.text3.pos = (WIDTH/5 + 25, self.text2.height + self.text2.pos.y)
        self.text4.pos = (WIDTH/9, HEIGHT - 30)
        spyral.event.register("input.keyboard.down.return", self.submit)

		#initiallize pebbles on subfrom side...
        self.firstnum = int(self.firstnum * 10)
        numString = str(self.firstnum)
        if(DIFFICULTY[diff]>0):
			decimal1 = Pebble(self, WHITE)
			decx = self.borrower.dx * 2.5 
			decy = HEIGHT/3 + WIDTH/25
			decimal1.pos = (decx, decy)
        for d in range(1,4):
			subfroms = []
			if(len(numString) >= d):
				n = int(numString[-1*d])
				for i in range(n):
					number = Pebble(self, (78*d,27*d,5*d))
					number.digit = d - 2
					x = self.borrower.dx * (4 - d)
					y = HEIGHT/3
					if i < 4:	
						x += (1.5 - i)*WIDTH/25
						y += WIDTH/25
					elif i < 7:
						x += (5 - i)*WIDTH/25
					elif i < 9:
						x += (7.5 - i)*WIDTH/25
						y -= WIDTH/25
					else:
						y -= 2*WIDTH/25
					number.pos = (x,y)
					subfroms.append(number)
			self.subFrom.append(subfroms)

		#initialize beakers on subby side...
        self.secondnum = int(self.secondnum * 10)
        numString = str(self.secondnum)
        if(DIFFICULTY[diff]>0):
            decimal2 = Pebble(self, WHITE)
            decx = self.borrower.dx * 2.5 
            decy = 2*HEIGHT/3 + WIDTH/25
            decimal2.pos = (decx, decy)
        for d in range(1,4):
            subbys = []
            if(len(numString) >= d and 3 + DIFFICULTY[diff] > 4 - d):
                lbeaker = LegitBeaker(self)
                lbeaker.x = self.borrower.dx * (4 - d) - (lbeaker.width/2)
                lbeaker.y = 2*HEIGHT/3 + WIDTH/25 - (lbeaker.height - 55)
                lbeaker.layer='beakerp'
                self.deakers.append(lbeaker)
                n = int(numString[-1*d])
                for i in range(n):
                    beaker = Beaker(self, diff)
                    x = self.borrower.dx * (4 - d) - (beaker.width/1.9)
                    y = 2*HEIGHT/3 + WIDTH/25 - (beaker.height * i)
                    beaker.pos = (x, y)
                    beaker.visible = True
                    beaker.layer = 'beaker'
                    subbys.append(beaker)
            self.subBy.append(subbys)

		#set keyboard control...
        spyral.event.register("input.keyboard.down.down", self.downPebble)
        spyral.event.register("input.keyboard.down.space", self.borrowFrom)

        pass