def draw(): global Maps, showGrid p5.background(0) Maps[0].show() if showGrid: p5.stroke(255) p5.no_fill() for x in range(Maps[0].gridWidth+1): x += (width/2)/scl-Maps[0].gridpos.x-0.5 for y in range(Maps[0].gridHeight+1): y += (height/2)/scl-Maps[0].gridpos.y-9/32 p5.begin_shape() p5.vertex(x*scl, y*scl) p5.vertex(x*scl, (y+1)*scl) p5.vertex((x+1)*scl, (y+1)*scl) p5.vertex((x+1)*scl, y*scl) p5.end_shape() if player.walking: Maps[0].move(player) player.walkingAnimation(Maps[0]) if player.walkTimer % player.walkingAnimationTime == 0 and player.stopRequest: player.walking = False player.walkTimer = 0 p5.fill(255, 0, 0, 70) # p5.rect((4*scl+scl*((width/2)/scl-Maps[0].gridpos.x-0.5),4*scl+scl*((height/2)/scl-Maps[0].gridpos.y-9/32)),scl,scl) player.show() print(Maps[0].gridpos.x, Maps[0].gridpos.y)
def draw(): p.translate(width / 2, height / 2) p.begin_shape() for i in range(6): p.vertex(100 * p.cos(p.radians(60 * i)), 100 * p.sin(p.radians(60 * i))) p.rotate(p.radians(60)) p.end_shape('CLOSE')
def draw(): p5.background(0) p5.stroke(255) p5.no_fill() p5.translate(width / 2, height / 2) p5.rotate_x(3.41459 / 3) p5.translate(-w / 2, -h / 2) for y in range(rows): p5.begin_shape("TRIANGLE_STRIP") for x in range(cols): p5.vertex(x * scl, y * scl, randint(-100, 100)) p5.vertex(x * scl, (y + 1) * scl, randint(-100, 100)) p5.end_shape()
def draw(): p5.background(0) p5.image_mode("CORNER") p5.image(Map.sprite, (0, 0), size=(Map.sprite.size[0] * screenScale / 6, Map.sprite.size[1] * screenScale / 6)) if not True: p5.stroke(255) p5.no_fill() for x in range(int(width / 16)): for y in range(int(height / 16)): p5.begin_shape() p5.vertex(x * scl, y * scl) p5.vertex(x * scl, (y + 1) * scl) p5.vertex((x + 1) * scl, (y + 1) * scl) p5.vertex((x + 1) * scl, y * scl) p5.end_shape() p5.rect_mode("CENTER") p5.fill(255, 0, 0, 90) for x, y in Map.bannedList: p5.rect((x * scl + 0.5 * scl, y * scl + 0.5 * scl), scl, scl)
def graphPoints(matrix): p.begin_shape() for pt in matrix: p.vertex(pt[0] * xscl, pt[1] * yscl) p.end_shape('CLOSE')
def polygon(sides, sz): p.begin_shape() for i in range(sides): step = p.radians(360 / sides) p.vertex(sz * p.cos(i * step), sz * p.sin(i * step)) p.end_shape('CLOSE')