import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation
def animate(i): global vx, vy # Update fruit position x, y = fruit.get_data() x += vx y += vy
ani = animation.FuncAnimation(fig, animate, frames=100, interval=100)
# Initialize the plot ax.set_xlim(0, 10) ax.set_ylim(0, 10)

