myCreature = {} myCreature["x"] = 250 myCreature["y"] = 250 myCreature["color"] = color(155,155,255) myCreature["size"] = 10 creatureList = [] def setup(): size(500, 500) rectMode(CENTER) c = {} c["x"] = 100 c["y"] = 100 c["color"] = color(255,155,155) c["size"] = 30 creatureList.append(c) c = {} c["x"] = 200 c["y"] = 200 c["color"] = color(155,255,155) c["size"] = 50 creatureList.append(c) def draw(): background(255) fill(myCreature["color"]) rect(myCreature["x"],myCreature["y"],myCreature["size"],myCreature["size"]) i = 0 while i < len(creatureList): creature = creatureList[i] fill(creature["color"]) rect(creature["x"],creature["y"],creature["size"],creature["size"]) i = i + 1 def keyPressed(): if key == 'i': myCreature["y"] = myCreature["y"] - 2 elif key == 'm': myCreature["y"] = myCreature["y"] + 2 elif key == 'j': myCreature["x"] = myCreature["x"] - 2 elif key == 'k': myCreature["x"] = myCreature["x"] + 2