When I replace display.newImage() with display.newImageRect I get the error"Attempt to index local ‘ground2’ (a nil value)", which is the first time ground2 is called after display.newImageRect(), with makes me think display.newImageRect() didn’t load the image.
Thank you for helping me this far