In my most recent WIP game I have ran into a little trouble which has got me thinking but my idea seems a little too complex. So here is what I want to do. After I open a menu and click the item I want to place, the menu closes and then I click where i want to place it and everything works great. Now here is the problem: How do I link each string (drawn in the menu so you know which one to click) with a (libgdx) texture (which is drawn once you click somewhere) Is there anyway to do this or would I have to just do something like this:
if(buildingStringIsClicked){
closeTheMenu;
batch.draw(twoStoryBuilding, 200, 200);
}
if(somethingElseStringIsClicked){
closeTheMenu;
batch.draw(someTexture, 200, 200);
}
//more if statements here for each string
Alternatively I could even create a method that takes a string and a texture as a parameter. The only reason I don’t want to do this is there may be around 100 different placable items creating a lot of method calling or if statements. I am not actually you can link a string and a texture together but does anyone have any advice in a direction to go from here, or would this method above be the way to go? All input is appreciated