I’m making a fnaf fan game and I want the doors to work right, so I want to assign 1 shoulder button (LB = Left door) (RB = Right door) to two actions, open and close. press once to open press once to close.
You want to increase the animation number, then divide it by the number of animations (2 in this case). Increasing it by 0 does not change the animation number.
That’s because you pause the animation at the beginning of the scene.
To fix this, instead of pausing the animations at the beginning, set the current frame to how ever many frames are in the animation (you’ll have to manually count the number of frames and put that in, there are no expressions for it )
Or let the animations play out and fade the scene in once the animations have finished. That just needs a black sprite covering the whole screen, and its opacity changed or tweened to 0 once the door animations are done.
Yes. If you change the number of animation frames, then the number you assign it to will have to change. There’s no expression that could be for that, unfortunately.
It’s a lot easier to use an object boolean, and if the door is open, then the animation is open, and the colission mask is different, or else, the player is only stopped if the boolean is false.
A button could easily switch on or off the boolean.
You could do that, but you can show a special door object as closed when open, like an illusion, if it’s a boolean, which just gives the dev a lot of extra power over level design.
Furthermore, if it’s a group, then some doorswon’t work if their animation is capitalized wrong or spelled wrong, while the boolean is just one thing to juggle.
Yep. Or you can use another sprite object, or another animation with different collision masks. Incorrect spelling or capiitalisation goes for variable names too.
The thing is, there’s often more than one way to code an effect. Usually either way is fine, and normally either way is easy to implement. I provided a solution keeping with the way OP had originally coded it. Minimal changes to get the desired effect.