how do to this, without coding each keys .. ?

Get help using Construct 2

Post » Fri Jan 10, 2014 5:17 pm

how do to this, without coding each keys .. ?


http://i.imgur.com/CgldAI3.jpg?1


in my game you can pick up some keys, which give you the possibility to destroy the assorted kind of wall.

i want more than 10 different WALLS/KEYS.

i could code for each object from KEY01 to KEY10
but i would like to know if its possible to code it in one time

------------

i have same problem, with some doors with a switch.
i know how to do it if i make code for each DOOR/switch , which are different objects.
but do the code one time for each couple of WALL/KEY or DOOR/switch working, i dont know how to do.


i hope you understand me.
thanks for help.
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Fri Jan 10, 2014 5:25 pm

You can simply add a variable "ID" to both your keys and doors.

Then upon picking the key, you check its ID variable, loop through all the available doors, find the one with the same ID, and destroy it.

On collision with Key
---For Each Walls in UID
---if Wall.ID == Key.ID
------Destroy the wall, then stop the loop.

I don't know if there is a more efficient solution though.
B
79
S
22
G
4
Posts: 311
Reputation: 12,774

Post » Fri Jan 10, 2014 6:08 pm

i never use the UID stuff...

do you have a capx where i can see how its done ?
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Mon Jan 13, 2014 11:05 am

bump .   sorry to make this post go up, but i really hope for a good answer, it would help me for many others situations.

if im not clear, or if you need any precisions, please ask. manukeo2014-01-13 11:06:00
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Mon Jan 13, 2014 12:09 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 » Mon Jan 13, 2014 12:25 pm

great ! its working perfecly !

@RamPackWobble thanks a lotmanukeo2014-01-13 12:26:09
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Mon Jan 13, 2014 12:44 pm

I just pointed it out - tutorial by @aguzz

This is also the same basic advice pointed out above by @Valerien RamPackWobble2014-01-13 12:47:08
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


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo, nickar and 46 guests