How do I make adjacent sprites clickable?

0 favourites
  • 7 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • 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?

  • Here's a picture, took a while to get it uploaded

    http:// imgur .com /a/xLM0x

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)