Because you provided no code samples we can just assume you redraw your scene every timer-tick and you might draw the just random-generated locations of the trees at every tick event, a solution like suggested by others is to generate the random coordinates of the trees before you draw the first time, save those coordinates and then when you redraw in your tick event those coordinates will still be the same coordinates as before so your trees will hold position. You might want to read an article about 2d development that explains the 3 basic steps of:
- Setting everything up/Initialize objects etc and draw the first
scene. - Calculate what changes between 2 shown pictures are made.
- Draw
the new picture/Update.
solved Redrawing only some objects? [closed]