I have many doors in my game, each door is opened and closed by a 'power cell', when the player hits the cell, (for the sake of animation) every 0.2 seconds I add one to a 'power cell charge' variable, when the charge reaches 7 I set a 'charged' bool to true.
At this point, the door opens along with some lights surrounding it.
To open the door I give every effected sprite a 'cellNumber' variable and I say:
When PowerCell is 'charge'
When PowerCell "PowerCellNumber" is 1
When Door "PowerCellNumber" is 1
When lights "PowerCellNumber" is 1
Open door & turn on lights.
I've got tens of doors in my levels, there's got to be a more simple way of doing this but I've wrestled with it for hours. This current system doesn't even work particularly well.
Can anyone help me out?
sounds like you are looking for the function object. Just code once and repeat with different parameters.
I tried this but it doesn't work because i have multiple instances of everything - It means if I open one door they all open lol
It should work if you call the function at the right spot and/or pass the right parameters to the function.
Try 'Pick By Comparison'. then pick all doors with PowerCellNumber the same as PowerCell.PowerCellNumber
I think using families, "pick by UID" and some arrays could be better.
Develop games in your browser. Powerful, performant & highly capable.
Wow pick by comparison almost works - but it doesn't work when I have it as 'trigger once' - which is something I need to do for the animation, sound and collisions etc