Modify instance variable of overlapped objects

  • I have 10 bugs that are movin around and collide with each other. One of them have the instance variable Infected = true and 9 of them Infected=false

    How can I spread the disease every time the infected bug collide with other noninfected bugs?

    In other words: How can I modify the instance variable of the bug colliding with the infected bug ?

  • <img src="http://img824.imageshack.us/img824/1939/clipboard01sgo.jpg" border="0" />

    I guess like that i guess

  • Semo can I use only one type of object instead of two types?

    Lets say when I create the bugs the first bug with UID=0 has the instance variable infected=true and the other 9 has infected=false.

    When the bug with variable infected=true collide with bug that has the variable infested=false I want to change from false to true.

    How can I do that ?

  • Might help if i could see the capx.

  • Cipriux

    I think it has something to do with the animation but i can't figure out how you did the animation. I can't do a check if the animation is playing or not. Sorry still learning myself.

    Personally i would just make a sprite with 2 frames. A normal one and a infected one. that way you can check which frame is set.

    Though i am interested how you did the animation because i don't see where its coming from. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Semo Thank you for you suport.

    I the bug sprite has 2 animations: normal and infected. When I create the bug tjey all have the first animation, but afterthat i pick the bug with IID(instance ID) 0 and change the amination to infected :)

    <img src="https://dl.dropbox.com/u/139926126/Forums/images/Capture3453465.PNG" border="0" />

  • Cipriux

    Well yeah i got that much but where is the animation itself? Its not a sprite or a frame so i can't figure out where its coming from. God now i feel totally noob <img src="smileys/smiley36.gif" border="0" align="middle" />

  • Semo   I don't understand what you want to ask.The animation is inside the sprite "bug". Right click on the sprite and select "edit animation". Did you open my capx file? or you have an older version of Construct?

  • Never mind the edit window was covering the animation window. That's why i was feeling noob lol.

    I'm not sure why its not working. It works when i change the check to "is not infected". All the normal ones infect each other on collision but i'm sure you knew that already.

    dl.dropbox.com/u/139739932/bug%20test/bugs.capx

    Sorry i could not help you. Anyone who can? This has me wondering now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem Semo

    The more I try to do stuff with Construct the more I realise I do not understand it :(

  • Have a look Here. Closer to what you want I think but still with problems...

  • This example might be what you are looking for:

    EvilSprites demo

    It's a simple example of collision between two instances of same object, I added a little 'infect' example there to show how you could achieve this. The problem with your approach is in the way you handle those collisions, take a look at some picking tutorials in the FAQ thread here and they should explain in more depth what I did in that example. :)

  • here is another try - Here

  • Thank you guys for the examples. I analyse them right now

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