Hi all,
I am writing a tile editor, more than anything it something I can get stuck into to learn the code better. anyway...
I open bitmap A which has a nice grid drawn on it 25 boxes across and 4 down I then open the sprite sheet and then grab the tile images out of it and paste them into the boxes and finally paste that to the bottom of the screen. The idea being I can simply click the tile and paint away with it.
They are all spaced out equally and I am using mousex() mousey() to work out what the mouse is over when clicked. Problem is I have made it for a sprite sheet 25 across and 4 down (100 tiles in all) (I am going to tweak it later so you can load in a different tile sheet if needed - anyway...)
100 tiles is 100 mouse detect commands e.g.
if mouseclick()=1 and mousex() >=7 and mousex() <=38 and mousey() >= 615 and mousey() <= 645
selectedtile = 1
wait 100
endif
if mouseclick()=1 and mousex() >=7+adj and mousex() <=38+adj and mousey() >= 615 and mousey() <= 645
selectedtile = 2
wait 100
endif
if mouseclick()=1 and mousex() >=7+(adj*2) and mousex() <=38+(adj*2) and mousey() >= 615 and mousey() <= 645
selectedtile = 3
wait 100
endif
if mouseclick()=1 and mousex() >=7+(adj*3) and mousex() <=38+(adj*3) and mousey() >= 615 and mousey() <= 645
selectedtile = 4
wait 100
endif
if mouseclick()=1 and mousex() >=7+(adj*4) and mousex() <=38+(adj*4) and mousey() >= 615 and mousey() <= 645
selectedtile = 5
wait 100
endif
(the adj is the 38 pixel adjustment between each tile)
I get the feeling I am missing something and maybe there is a much smarter way to do this.
Just thought I would throw it out to the pros here to see if they can point me in the right direction.
Thanks in advance for any help/tips