def __init__(self, x, y): self.x = x self.y = y self.tx = x self.ty = y self.image = [ ccircle.Image('cat_n.png'), ccircle.Image('cat_e.png'), ccircle.Image('cat_s.png'), ccircle.Image('cat_w.png'), ] self.facing = West
def __init__(self, **kwargs): self.imageBG = ccircle.Image('space.png') self.imageGoal = ccircle.Image('pizza.png') if 'size' in kwargs: self.clear(kwargs['size']) elif 'layout' in kwargs: self.load(kwargs['layout']) else: raise Exception( 'Failed to create cat.World: keyword argument must be either size or layout' )
def __init__(self, angle, x, y, width, height, size, money, type): self.pice1 = ccircle.Image("pice 4.jpg") self.pice1.eraseWhite() self.pice2 = ccircle.Image("pice 9.jpg") self.pice2.eraseWhite() self.angle = angle self.x = x self.y = y self.width = width self.height = height self.size = size self.money = 1000 self.type = type
def image(name): global cache_images x = cache_image.get(name, None) if x: return x x = ccircle.Image('../image/%s' % name) cache_image[name] = x return x
Shot Cannon Shell Cannon Spray Cannon Machine Gun Catapult Axe OctoGun Shop? Ice Beam? ''' window = ccircle.Window() window.toggleMaximized() archer = ccircle.Image('Crossbow.png') catapult = ccircle.Image('Catapult.png') cannon1 = ccircle.Image('Cannon1.png') cannon2 = ccircle.Image('Cannon2.png') cannon3 = ccircle.Image('Cannon3.png') machine = ccircle.Image('MachineGun.png') axe = ccircle.Image('Axe.png') laser = ccircle.Image('Laser.png') archerz = ccircle.Image('Crossbowz.png') catapultz = ccircle.Image('Catapultz.png') cannon1z = ccircle.Image('Cannon1z.png') cannon2z = ccircle.Image('Cannon2z.png') cannon3z = ccircle.Image('Cannon3z.png') machinez = ccircle.Image('MachineGunz.png') axez = ccircle.Image('Axez.png')
def __init__(self, angle, pos): self.background = ccircle.Image("background.jpg") self.angle = angle self.pos = pos self.state = 'up'
import os d = os.path.dirname(os.path.realpath(__file__)) import sys sys.path.append(d + '\\dist') import ccircle import random import time from math import * window = ccircle.Window('CCircle Module Test', 800, 800) cat = ccircle.Image('res/cat.png') font = ccircle.Font('res/FiraMono.ttf') sound = ccircle.Sound() sound.addSine(0, 1, 120, 0.2) sound.addSine(0, 1, 60, 0.2) sound.addSine(0, 1, 90, 0.2) sound.addSaw(1, 2, 60, 0.2) sound.addSaw(1, 2, 240, 0.2) sound.addSaw(1, 2, 480, 0.2) sound.play() t = 0 while window.isOpen(): window.clear(0.1, 0.1, 0.1) mx, my = window.getMousePos() window.drawPoint(mx, my, 8) t += 1.0 cat.draw(16, 16, 128, 128, t)
import os d = os.path.dirname(os.path.realpath(__file__)) import sys sys.path.append(d + '\\dist') import ccircle import random import time from math import * window = ccircle.Window('CCircle Module Test', 800, 800) cat = ccircle.Image('res/cat.png') bg = ccircle.Image('res/pizza.png') cat.eraseRed() font = ccircle.Font('res/FiraMono.ttf') catPixels = [ (x, y, cat.getPixel(4 * x, 4 * y)) for y in range(int(cat.height/4)) for x in range(int(cat.width/4)) ] t = 0 while window.isOpen(): window.clear(0.1, 0.1, 0.1) wx, wy = window.getSize() mx, my = window.getMousePos() window.drawPoint(mx, my, 8) bg.draw(0, 0, wx, wy) t += 1.0 cat.draw(16, 16, 128, 128, t) cx, cy = cat.getSize() cat.drawSub(128, 32, 128, 128, cx / 4, cy / 4, cx / 8, cy / 8, -t)