now my problem is I get the error saying like..
"Code takes excatly 2 arguments"
Also.. I drew a circle in the middle of the screen, the Zombie won't ever enter this area so basically this will be a safe spot for you (the cat).
I do not know how to make the zombie unable to go there nor how to make it chase you, I would know how to make it unable to go to the circle by controlling the cordinates but since it's a circle it'd take tons of cordinates unless I use derivata somehow but I don't remember how cause it's a long time ago I studied that in school.
please, help me someone.
bif="bg.jpg"
mif="cat.png"
wif="Zombie.png"
import pygame, sys
from pygame.locals import *
class FUNCTIONS(object):
#def __init__(self):
#a, b = mouse_c.size
#return a*2, b*2
#a = mouse_c.getWidth()
#return a*2
#def __init__(self):
#b = mouse_c.getHeight()
#return b*2
def RESIZE(self, ResizeOBJ):
a, b = mouse_c.size
a*2, b*2
ResizeOBJ = pygame.transform.scale(ResizeOBJ, (a,B)/>)
pygame.init()
screen=pygame.display.set_mode((700,525),0,32)
background=pygame.image.load(bif).convert()
mouse_c=pygame.image.load(mif).convert_alpha() # This is the character
zombie=pygame.image.load(wif).convert_alpha() # The zombie/enemy
# This is the characters "attributes"
x, y = 350, 262
movex, movey = 0, 0
speed = 250
# This is the zombies "attributes"
x2, y2 = 0, 0
movex2, movey2 = 0, 0
speed2 = 100
# Clock and using the function
clock=pygame.time.Clock()
Thing=FUNCTIONS()
Funct=Thing.RESIZE()
#Making a circle for safe area
color=(135,17,70)
position=(350, 262)
radius=(120)
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN: # Movements/keys
if event.key == K_LEFT:
movex-=dm
elif event.key == K_RIGHT:
movex+=dm
elif event.key == K_UP:
movey-=dm
elif event.key == K_DOWN:
movey+=dm
elif event.key == K_SPACE: # Scale the character 2x
Funct(mouse_c)
if event.type == KEYUP:
if event.key == K_LEFT:
movex=0
elif event.key == K_RIGHT:
movex=0
elif event.key == K_UP:
movey=0
elif event.key == K_DOWN:
movey=0
if x >= 0 and x <= 700: # prevent walking outside screen
x += movex
else:
x = 350
if y >= 0 and y <= 525: # prevent walking outside screen
y += movey
else:
y = 263
#Drawing the circle
screen.lock()
pygame.draw.circle(screen, color, position, radius)
#pygame.draw.rect(screen, color,
screen.unlock()
# Setting the character/zombie speed
milli=clock.tick()
seconds=milli/1000.0
dm=seconds*speed
dm2=seconds*speed2
# Displaying them
screen.blit(background, (0,0))
screen.blit(mouse_c, (x,y))
screen.blit(zombie, (x2,y2))
pygame.display.update()
kind regards, Marcus

New Topic/Question
Reply



MultiQuote





|