@Soob
In game programming, you do not manipulate objects directly on the screen. Instead you create a virtual world, let's call it game world.
In most cases, you can use a 2 dimension array for the game world. Each position in the array (let's call it cell), can be occupied by an object. But for more complex games, each cell can have more than one object.
If you don't mind following a long boring tutorial, I recommend you to read the posts I wrote to explain a simple snake game:
https://forum.lazarus.freepascal.org/index.php/topic,38136.msg258381.html#msg258381In the snake game tutorial, each cell can be empty or occupied by a snake's body or a fruit. That's why:
Type
TItem = (Empty, Snake, Fruit);
var
GameWorld: array[1..WorldWidth, 1..WorldHeight] of TItem;
Note:
For beginner friendly reason, the array start from 1. But 'real' programmers count from 0.
Here is the most important thing when write a game:
Don't manipulate objects directly on the screen. Instead, you do it on the game world. Then write a procedure to draw the game world to the screen. When user moves the mouse or presses a button or key, process the user input based on the game world not the screen.Have fun.
---edit---
Lucamar's suggestion is okay. It is beginner friendly, it starts simpler and easier but when you adds more features, it will be less (perfomance) efficient and harder to maintain.