# Remember that code in blue (thick underline) is newly added from the previous step
# And code in orange (thin underline) is modified from the previous step

myCreature = {}
myCreature["x"] = 250
myCreature["y"] = 250
myCreature["color"] = color(155,155,255)

creatureList = []

def setup():
    size(500, 500)
    rectMode(CENTER)

    c = {}
    c["x"] = 100
    c["y"] = 100
    c["color"] = color(255,155,155)
    creatureList.append(c)

    c = {}
    c["x"] = 200
    c["y"] = 200
    c["color"] = color(155,255,155)
    creatureList.append(c)


def draw():
    background(255)

    fill(myCreature["color"])
    rect(myCreature["x"],myCreature["y"],10,10)

    i = 0
    while i < len(creatureList):
        creature = creatureList[i]
        fill(creature["color"])
        rect(creature["x"],creature["y"],10,10)
        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