Didn't quite read everything,however might I suggest something:
- Create a sprite and in your loop , position it where the mouse is.Then either use that sprite as your cursor,or just hide it.
- Check for collision between that sprite and the rest of your sprites using a loop and add a mouseclick()=1 condition (Check your documentation for the commands).
- Assign the clicked sprite's id to a variable and then if the mouse is clicked again,check for collision with the rest of your sprites and position the selected previously sprite to the x and y of the newly selected (grid) sprite.
Bit of pseudo-code:
spritecount = number of item sprites (not the grid)
grid_start = starting number for grid sprites
grid_end = ending number respectively
for i=1 to spritecount
if sprite collision(cursor_sprite,i) and mouseclick()=1
clicked=i
endif
next i
for i=grid_start to grid_end
if sprite collision(cursor_sprite,i) and clicked>0 and mouseclick()=1
sprite clicked,sprite x(i),sprite y(i),image_id_for_selected_sprite
clicked=0
endif
next i
Hope this helps,and I hope I've understood your question/s
Samotnijat vylk nasred gorata.
-3D,2D Artist,Animator,Web developer and Programmer.