Instance picking problems

Get help using Construct 2

Post » Wed Feb 12, 2014 2:00 pm

I have the following capx
https://www.dropbox.com/s/t8scqoqql2g9qm9/instancepicking.capx

I'm trying to get the goodies to fire independently from each other.

I need the goodies to detect the baddies only when a baddie is on the same Y position as the goodie. I tried this using; abs(goodie.Y-baddieY) < 2000 which seems to work but, whenever any baddie is on the same Y as a goodie all the goodies fire. The bottom baddie is slightly off the Y of the goodie but, the goodie still fires.

Do I need to foreach the baddies as well?

Thanks in advance.
Dave
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Feb 12, 2014 2:09 pm

I might just have solved this myself :)
https://www.dropbox.com/s/q7o8cxko9fkycf8/instancepickingsolved.capx
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Feb 12, 2014 2:29 pm

Arh, they still don't seem to be firing independently, if I give the baddies drag&drop behaviour and move a baddie in and out of Y range the goodies wait and fire all at the same time.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Feb 12, 2014 3:32 pm

https://www.dropbox.com/s/vxinpqowllu0p32/for%20each%20test.capx ?

not fully tested !
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Wed Feb 12, 2014 4:17 pm

Works great and I have learnt something, thanks for the help.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Feb 12, 2014 5:17 pm

I actually have a new problem now, I'm trying to recreate a kinda plants vs zombies mechanic.

Check out this capx;
https://www.dropbox.com/s/l5gvplui395vytq/foreachtest2.capx

Each goodie is firing independently from each other on the Y thanks to Rampack but, still at the same time on the X. I have a check for X distance which does work but, for all goodies on the X. I'm pretty sure it's something to do with starting the timer within the baddies foreach loop, maybe I need a little break my head is hurting :)
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Feb 12, 2014 5:40 pm

I think I have it, for anyone else needing the functionality
https://www.dropbox.com/s/q6y63m048anr2yo/gotit.capx
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Wed Feb 12, 2014 5:57 pm

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Wed Feb 12, 2014 6:09 pm

Actually I think your way is better as mine will run for all 9 goodies where as your will only run for the picked ones.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Wed Feb 12, 2014 6:22 pm

Thanks you steered me in the right direction. Not sure how well it will perform with a ton of goodies and baddies, will have to do some stress testing.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 29 guests