Move the box with keyboard and mouse

That’s not much of a plan to work with. Anyhow, here’s a little bullets demo that riffs off some code from another post

class bullet(object):
    def __init__ (self, xpos, ypos, speed):
        self.xpos = xpos
        self.ypos = ypos
        self.speed = speed
        
    def show(self):
        rect(self.xpos, self.ypos, 10, 10)

def setup():
    size(500, 500)
    global bullets
    bullets = []
    
def draw():
    background(0)
    for b in bullets:
        b.xpos -= b.speed
        b.show()

def mousePressed():
    bullets.append(bullet(mouseX, mouseY, -3))
    print(len(bullets))  # print the number of bullets

It’ll take some work to integrate. I assume that your bullets must move at angles, so I’d recommend vectors over xpos/ypos/speed values. Also, the bullets list just keeps on growing – as you’ll see in the console. The bullets continue to drift through space somewhere beyond the edge of the display window, never expiring.