S
squirrelah
Guest
I have a few questions about optimizing for increased performance. I know very little about this, so any tips will help, but I also have a few direct questions.
Is there a benefit to using events like left mouse pressed, keyboard pressed, key pressed, etc above setting a variable in the step event equal to change the variable to true if it is pressed and then running everything in the step event?
For example, let's say I want my character to move up when I press "w". To do this I have a variable set to true when w is pressed, and then code that moves him up when that variable is true in the step event.
Alternatively, I could just have that code run in the "key pressed letters "w"" page, and not have it run every step.
In addition how many global variables is too many? I know it can affect performance issues, but I don't really have a clear understanding of when it becomes too many. I think right now I have about 30 and I don't notice any issues, and I only use them because it was a lot simpler to do so.
Or is any of this even worth worrying about? I haven't gotten anywhere close to animations and sound, and I have a feeling doing that correctly is far more important than this but I just don't know enough about it to be sure.
What im really worried about is making something, getting really far in and having to backtrack to optimize because i didn't do it before.
Is there a benefit to using events like left mouse pressed, keyboard pressed, key pressed, etc above setting a variable in the step event equal to change the variable to true if it is pressed and then running everything in the step event?
For example, let's say I want my character to move up when I press "w". To do this I have a variable set to true when w is pressed, and then code that moves him up when that variable is true in the step event.
Alternatively, I could just have that code run in the "key pressed letters "w"" page, and not have it run every step.
In addition how many global variables is too many? I know it can affect performance issues, but I don't really have a clear understanding of when it becomes too many. I think right now I have about 30 and I don't notice any issues, and I only use them because it was a lot simpler to do so.
Or is any of this even worth worrying about? I haven't gotten anywhere close to animations and sound, and I have a feeling doing that correctly is far more important than this but I just don't know enough about it to be sure.
What im really worried about is making something, getting really far in and having to backtrack to optimize because i didn't do it before.