Modify instance variable of overlapped objects

Get help using Construct 2

Post » Thu Feb 28, 2013 3:47 pm

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 ?Cipriux2013-02-28 15:56:22
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Thu Feb 28, 2013 4:27 pm



I guess like that i guess
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Thu Feb 28, 2013 4:41 pm

@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 ?Cipriux2013-02-28 16:44:00
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Thu Feb 28, 2013 5:03 pm

Might help if i could see the capx.
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Thu Feb 28, 2013 6:07 pm

@Semo, here is a quick example
https://dl.dropbox.com/u/139926126/Forums/Bug_test.capxCipriux2013-02-28 18:08:24
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Thu Feb 28, 2013 10:53 pm

@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.
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Thu Feb 28, 2013 11:25 pm

@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 :)
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Thu Feb 28, 2013 11:28 pm

@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
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Thu Feb 28, 2013 11:48 pm

@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?
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Fri Mar 01, 2013 12:13 am

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.

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

Sorry i could not help you. Anyone who can? This has me wondering now.Semo2013-03-01 00:14:09
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Next

Return to How do I....?

Who is online

Users browsing this forum: Colorfish, Waltuo and 4 guests