Bitwise comparisons

This forum is currently in read-only mode.
  • Bitwise operations can be very useful at times, particularly when dealing with long lists of flags. It feels like such a waste to me to designate 30 private variables, each of which only needs to check for being a 1 or a 0 anyway. Perhaps allowing a boolean type would also satisfy me, but there's just something elegant about a nice Bitwise OR.

  • You could use for a 'for' or 'repeat x times' loop to go through the variables and check them, if they are all named something like 'Variable5', 'Variable28' or something.

    One thing we could add though is a 'For each private variable', which may help here.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I decided to use hash tables for that.

  • Add one to the list of people who doesn't like a bunch of global variables hanging around. I don't know, it just seems messy. (IMHO)

  • I never got to hash tables in my classes. How do they work?

    Is implementing bitwise operations really that tricky? (not a rhetorical question)

  • Getting rid of bugs is now at higher priority than adding new functionalities.

    On the other hand I think that most of us have his/her own techniques when dealing with data. If everyone's wishes were fulfilled, you'll get your bitwise operations, but also 10 other techniques for handling values (flags system/stacks/queues/lists/dictionaries/pointers/some weird data management templates used by 1 person on the world/other stuff), what would make Construct messy. Simplicity is key for success here.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)