Overlapping same object type and checking variables?

Get help using Construct 2

Post » Wed Jan 27, 2016 2:54 am

Edit: blackhornet fixed the old problem below but now I have a new problem. In another layout of my game If a sprite with a powerup overlaps another sprite with a powerup, only the first sprite's size is changed to 50,50. not both. How would I do this?

Old Problem: In my game if a sprite with a powerup overlaps another sprite without a powerup, the sprite without a powerup has his size changed to 16,16.

If a sprite with a powerup overlaps another sprite with a powerup, both their sizes are changed to 50,50.

I got the second part working, but the problem is when a sprite with a powerup, overlaps a sprite without a powerup the first sprite changes size but it should stay the same.

How do I fix this?

Here's the link to my cap: http://www.mediafire.com/download/ron6o ... ables.capx
Last edited by JackieChan on Fri Jan 29, 2016 2:29 am, edited 4 times in total.
B
10
S
4
G
6
Posts: 80
Reputation: 3,623

Post » Wed Jan 27, 2016 3:21 am

In your first block of events, above where you set the family size, add an action to set the size of the greenSprite to whatever its default size is and it will work. I'm guessing because you've differentiated between an instance and a family in the event that you also need to do this in the action, otherwise it will just blanket it under the family and apply the size change to both.
B
59
S
22
G
4
Posts: 182
Reputation: 6,528

Post » Wed Jan 27, 2016 3:36 am

Thanks but I just tried that and it still doesn't work.

Link: http://www.mediafire.com/download/jmei3 ... ables.capx

Does anybody know a good way to pick between two objects of the same type when they're overlapping and compare their variables?
B
10
S
4
G
6
Posts: 80
Reputation: 3,623

Post » Wed Jan 27, 2016 8:01 am

Sorry, it's possible I misunderstood what you're trying to do - try this caphttps://www.dropbox.com/s/zjzz44zvarv8hfy/test.capx?dl=0 - from your description, it seems to do that - when the sprite with the power overlaps the one without, the powered sprite stays the same size but the unpowered one reduces in size.
B
59
S
22
G
4
Posts: 182
Reputation: 6,528

Post » Thu Jan 28, 2016 1:15 am

This still doesn't work. You changed all the sprites sizes to 64,64 but I need them to all be different like in the cap in my first post.

Does anybody know a fix for this?
B
10
S
4
G
6
Posts: 80
Reputation: 3,623

Post » Thu Jan 28, 2016 2:24 am

You have to be careful of your picking order.
http://www.blackhornettechnologies.com/ ... s_BHT.capx
ImageImageImage
B
71
S
19
G
179
Posts: 3,476
Reputation: 102,668

Post » Thu Jan 28, 2016 4:05 am

Thanks that does fix this problem, but I have another issue.

In another layout of my game If a sprite with a powerup overlaps another sprite with a powerup, only the first sprite's size is changed to 50,50. not both.

How would I do this?
B
10
S
4
G
6
Posts: 80
Reputation: 3,623

Post » Thu Jan 28, 2016 4:48 am

I saw that as I was working on your code. Switching to the method I provided fixed it.
ImageImageImage
B
71
S
19
G
179
Posts: 3,476
Reputation: 102,668

Post » Thu Jan 28, 2016 2:16 pm

Thanks I switched to your method and that worked, but in another layout of my game If a sprite with a powerup overlaps another sprite with a powerup, only the first sprite's size is changed to 50,50. not both.

How do I make this?
B
10
S
4
G
6
Posts: 80
Reputation: 3,623

Post » Thu Jan 28, 2016 3:32 pm

You'll have to post another example, as my sample should work.
ImageImageImage
B
71
S
19
G
179
Posts: 3,476
Reputation: 102,668

Next

Return to How do I....?

Who is online

Users browsing this forum: Maako and 10 guests