Esempio n. 1
0
import pygame
import utils
from clean_player import Player

clock = pygame.time.Clock()
pygame.init()
all = pygame.sprite.RenderUpdates()
screen, screct, backgr = utils.pygameSetup(1280, 720, "TEST POST PLEASE IGNORE")
player = Player("spr/p.png")
enemy = Player("spr/e.png")
player.rect.y = 225; enemy.rect.y = 225
all.add(player)
all.add(enemy)
player.rect.x = player.rect.x + 50
screen.fill([0,0,0])
temp = (0,0)
while True:
	screen.fill([0,0,0])
	clock.tick(60)
	player.react()
	if player.rect.colliderect(enemy.rect):
		print "BOOMHEADSHOT"
		player.rect.x = player.rect.x + 100
	if player.m:
		if player.f == 'l':
			player.left()
		elif player.f == 'r':
			player.right()
	pygame.display.update(all.draw(screen))
	#pygame.display.update(changed)
	#pygame.time.delay(50)
Esempio n. 2
0
import pygame
import utils

screen, screct = utils.pygameSetup(1280, 720, "Shape testing: DUMB STATIC GRAPHIC")
body = pygame.Surface([90, 160])
body.fill([0, 0, 0, .5])
bodyrect = body.get_rect()
bodyrect.x = screct.w/2
bodyrect.y = (screct.h/2)-(bodyrect.h/2)
drawitplzx, drawitplzy = bodyrect.midleft
print bodyrect.bottomleft, bodyrect.bottom
workx, worky = bodyrect.midleft
workx = workx - bodyrect.w/2

while True:
	screen.fill([255,255,255])
	pygame.draw.line(screen, [0,0,0], [bodyrect.x, bodyrect.y+(bodyrect.y/2)], [bodyrect.x,bodyrect.y])
	pygame.draw.circle(screen, [0,0,0], [(bodyrect.x), (bodyrect.y-50)], 50)
	pygame.draw.line(screen, [0,0,0], [bodyrect.x,bodyrect.y+15],[drawitplzx+45, drawitplzy])
	pygame.draw.line(screen, [0,0,0], [bodyrect.x,bodyrect.y+15], [workx, worky])
	pygame.draw.line(screen, [0,0,0], [bodyrect.x, bodyrect.bottom-20], [bodyrect.x+15, bodyrect.bottom+100])
	pygame.draw.line(screen, [0,0,0], [bodyrect.x, bodyrect.bottom-20], [bodyrect.x-15, bodyrect.bottom+100])
	pygame.display.flip()
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			break

Esempio n. 3
0
import pygame
import random
import utils
#utils in incomplete!
pygame.init()
fpsClock = pygame.time.Clock()
print pygame.font.get_init()
all_fonts = pygame.font.get_fonts()
rgb=utils.randrgb()
for font in all_fonts:
	print font
print "DEFAULT FONT: " + str(pygame.font.get_default_font())
screen, screct = utils.pygameSetup(1280, 720, "Fonts lesson")
cnew = pygame.font.SysFont("couriernew",15,False,False)
text = cnew.render("I HATE YOU", False, [0,0,0])
while True:
	fpsClock.tick(10)
	rgb=utils.randrgb()
	screen.fill(rgb)
	screen.blit(text, [screct.w/2, screct.h/2])
	pygame.display.flip()
Esempio n. 4
0
import pygame
import utils

fpsClock = pygame.time.Clock()
reusedValue = -1
screen,screct = utils.pygameSetup(1280, 720, "Code Playground")
choice = utils.choose("Are you epileptic? 1 or True = yes, 0 or False = no")
if choice:
	while True:
		fpsClock.tick(75)
		reusedValue = utils.strobe(screen, reusedValue)
		pygame.display.flip()
Esempio n. 5
0
import pygame
import utils
import time
from player import Player
from enemy import Enemy
#Mirror's Edge, except less wall jumping, and more enemy dodging. Fighting should be just as one-sided towards the enemy. Oh, and stick figure graphics.
#... because I can't do any better art, and I won't even be satisfied with one sprite until I've been working on it for hours.
#I want to expand on this game at some point. It's a pretty good base, I even derived an "engine" of sorts from it's earlier form.
clock = pygame.time.Clock()
pygame.init()
all = pygame.sprite.RenderUpdates()
enemies = pygame.sprite.RenderUpdates()
hit = pygame.sprite.Group()
screen, screct, backgr = utils.pygameSetup(1280, 720, "Stick Figure Ninja", [255,255,255])
player = Player(["spr/s.png", "spr/s2.png", "spr/sj1.png", "spr/sj2.png", "spr/ss.png", "spr/sw1.png", "spr/sw2.png", "spr/sw3.png", "spr/sw3.png", "spr/sw4.png"])
enemy = Enemy(["spr/es.png", "spr/es2.png", "spr/esj1.png", "spr/esj2.png", "spr/ess.png", "spr/esw1.png", "spr/esw2.png", "spr/esw3.png", "spr/esw4.png"])
player.rect.y = 225; enemy.rect.y = 225
all.add(player)
all.add(enemy)
enemies.add(enemy)
player.rect.x = player.rect.x + 50
enemy.rect.x = screct.w/2
screen.fill([0,0,0])
player.y = player.rect.y
hits = 0
flist=pygame.font.get_fonts()
flist.sort()
for item in flist: print item
font = pygame.font.SysFont('consolas',25)
text = font.render("You can do eet", False, [0,0,0], [255,255,255])
health=font.render("You can do eet 2", False, [0,0,0], [255,255,255])