Hello,
just wondering, i am planning out a platform game, a simple character with a slash attach etc, wondering, with animation, moving, attach, jump, hurt etc., should i make a script for each of these, taking to account should i make it for the sake of simplicity or performance, would it be better to separate all of these out per script (attacking, animation, enemies hit, health) or should i keep it together? again sorry if this doesn’t make sense, hope it does, i am trying to do it right for the sake of making it easy to read, performance, and able to expand if needed.
thanks in advance
More scripts take more memory but are easier to read and debug.
Less scripts take less memory, harder to read and debug.
Performance wise, I don’t have benchmarks but I don’t think it would make much of a difference between the two.
I wouldn’t worry about how big or small you make scripts, do what works. Take advantage of OOP and remember what you start off with will probably be different in the end. You will probably rewrite code a lot during the development process. Its a learning process and you can only get better.
For what you are asking directly in my opinion, I would keep it in one place. Somebody else my find it works for them in different scripts, it comes down to preference and work flow. Some places you work for may want it a certain way, buy it really doesn’t matter as long as it works in the end.