Good way to handle triggers???

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

Re: Good way to handle triggers???

Postby shatterblast » Tue Dec 31, 2019 4:17 pm

It depends on how you want to store them. It's usually good to create your own classes for the objects you want to represent. For instance, one method could represent all the handling of the boolean variables for the class, holding it. You could return a single boolean variable from the method if all the stuff you want handled becomes satisfied. You could then move on to the next object in your code that handles its own boolean variables.

Just don't let your class that stores the boolean variables extend something else when you do that. Otherwise, troubleshooting can become difficult. However, it's okay to let a class that handles the processing of your logic to do so.

You might consider using an Interface for keeping all your related items the same when you design a class that holds a bunch of boolean variables by itself. It will help your IDE keep your code straight. You can use more than one Interface of course for a single class if you feel a special need beyond your standard Interface.
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm

Return to General Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest