myX = 250
myY = 250
myColor = color(155,155,255)
xList = []
yList = []
cList = []
def setup():
size(500, 500)
rectMode(CENTER)
xList.append(100)
yList.append(100)
cList.append( color(255,155,155) )
xList.append(200)
yList.append(200)
cList.append( color(155,255,155) )
def draw():
background(255)
drawCreature(myColor,myX,myY)
i = 0
while i < len(xList):
drawCreature(cList[i],xList[i],yList[i])
i = i + 1
def drawCreature(c,x,y):
fill(c)
rect(x,y,10,10)
def keyPressed():
global myX, myY
if key == 'i':
myY = myY - 2
elif key == 'm':
myY = myY + 2
elif key == 'j':
myX = myX - 2
elif key == 'k':
myX = myX + 2