How do I make adjacent sprites clickable?

0 favourites
  • 7 posts
From the Asset Store
Build your map with these isometric objects and terrains
  • I'm trying to make a grid system where you can click on an adjacent block to turn it red. I've placed sprite blocks in a grid system and put a boolean variable on each sprite that determines whether or not it's clickable depending on its adjacency to other blocks. Sometimes it does not set variable to true even though other times it should, even when multiple act on the same block it should set it to the same state.

  • Probably some logic error but it's impossible to tell without an event sheet. can you post a screenshot of the event sheet, the game screen or a link to the capx?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's a picture, took a while to get it uploaded

    http:// imgur .com /a/xLM0x

  • Seems alrite, are the tile positions definitely +/- 100 of each other. Launch in debug and check the co-ords, clickable won't be true if it's slightly out. Change the opacity of clickable tiles so it's easier to see for testing.

  • Tiles are definitely exactly 100 +/- of one another. It seems random which tiles are clickable, though the ones that are clickable are adjacent like we want them to be. All we are able to tell is that it might depend on the order in which we click the initial tiles.

  • Ah I just ran a test and I can see what's happening. It's only comparing against previous IU tiles and not always picking the new one. Put your x,y checks within a For each IU tile event, that way you know it's checking adjacent tiles on every IU tile.

  • That seems to have worked! Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)