"Connected" sprites

0 favourites
  • 3 posts
From the Asset Store
Build your map with these isometric objects and terrains
  • Hello,

    I've faced another problem. I have a playing field inside my game which is based on tiles (I've used the "Jump&Run" Tutorial as a base for it). On this field there are some bombs which can detonate if the player fire them. If there are bombs on the neighbor field they should also explode. There are different kind of bombs with a different "explosion" radius in that other bombs should also explode...

    Any idea how I can implement this feature? I've tried to check if another bomb is inside the explosion radius but it didn't work. I've also tried to give all bombs an instance variable (x,y) and check if another bomb is on a neighbor field, but this looks to be "not right"... :-(

    Best,

    Benny

  • I've found something using the "distance" expression:

    scirra.com/forum/how-do-i-get-all-objects-in-a-radius_topic48595_post305201.html

    My current object is called "bomb" and I want all "bombs" in a specific radius to also explode... how can I do it with the engine?

    "for each objectThatyouwantTopick

    -distance(pointofexplosion.x,pointofexplosion.y, objectThatyouwantTopick.x, objectThatyouwantTopick.y) < radius, do stuff"

    Means:

    for each bomb

    -distance(bomb.x,bomb.y,bomb[from foreach].x, bomb[from foreach].y) < radius

    How can I seperate between the items of the foreach and the bomb item that has exploded?

    Best,

    Benny

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A different solution might be to create an invisible circle sprite when a bomb explodes, and then check which other bombs are overlapping it. You could change the scale of the radius for lots of different occasions based on your gameplay.

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