Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. A problem of great decision

A problem of great decision

Scheduled Pinned Locked Moved C#
helptutorialquestiongame-dev
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Q12_
    wrote on last edited by
    #1

    This issue I have it for a while, almost 1 year or more. I tried diverse permutations but always got stuck at some point, when the whole idea will not work anymore. And I give up all the time on it. I have a class with properties, fields and methods in it. I am thinking to add events to it, but im not that great at them yet. When i call this class into form1 I basically change some values inside class, and the "object" that represents it, will add value or change color or change position ,etc. If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example. I had a lot of similar (and more complex) encounters with this subject and I simply freeze in the middle of it, not knowing how to manage it anymore. Both ways are good! From outside or from inside class. But... sometime i need maneuverability, sometime is just in the way and i want it 'there' behind some close door(inside class I mean). What your rules say about this thing? Should I change its values from inside the class? Or from outside? Thank you. ------ thanks to OriginalGriff i relocated here the question.

    q12

    S L 3 Replies Last reply
    0
    • _ _Q12_

      This issue I have it for a while, almost 1 year or more. I tried diverse permutations but always got stuck at some point, when the whole idea will not work anymore. And I give up all the time on it. I have a class with properties, fields and methods in it. I am thinking to add events to it, but im not that great at them yet. When i call this class into form1 I basically change some values inside class, and the "object" that represents it, will add value or change color or change position ,etc. If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example. I had a lot of similar (and more complex) encounters with this subject and I simply freeze in the middle of it, not knowing how to manage it anymore. Both ways are good! From outside or from inside class. But... sometime i need maneuverability, sometime is just in the way and i want it 'there' behind some close door(inside class I mean). What your rules say about this thing? Should I change its values from inside the class? Or from outside? Thank you. ------ thanks to OriginalGriff i relocated here the question.

      q12

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #2

      Don't sweat it, it's something you will learn to decide better as time goes. As a rule, if your property has public setter it implied people will set it from outside! ;) Property usually have very simple set/get behaviour. But you could imagine the class having an Update() method that does some property updating. As well as an external agent modifying them wen needed.

      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

      1 Reply Last reply
      0
      • _ _Q12_

        This issue I have it for a while, almost 1 year or more. I tried diverse permutations but always got stuck at some point, when the whole idea will not work anymore. And I give up all the time on it. I have a class with properties, fields and methods in it. I am thinking to add events to it, but im not that great at them yet. When i call this class into form1 I basically change some values inside class, and the "object" that represents it, will add value or change color or change position ,etc. If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example. I had a lot of similar (and more complex) encounters with this subject and I simply freeze in the middle of it, not knowing how to manage it anymore. Both ways are good! From outside or from inside class. But... sometime i need maneuverability, sometime is just in the way and i want it 'there' behind some close door(inside class I mean). What your rules say about this thing? Should I change its values from inside the class? Or from outside? Thank you. ------ thanks to OriginalGriff i relocated here the question.

        q12

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        _Q12_ wrote:

        If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example.

        Inside, since it is part of.

        _Q12_ wrote:

        Both ways are good!

        Nope. Breathing would be done by a "AirSupplier", a base class that both Lungs and Gills inherit from. That way you can instantiate a fish with gills, and a rat with lungs. Add an IBreathable interface for quick filtering of breathing things.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

        1 Reply Last reply
        0
        • _ _Q12_

          This issue I have it for a while, almost 1 year or more. I tried diverse permutations but always got stuck at some point, when the whole idea will not work anymore. And I give up all the time on it. I have a class with properties, fields and methods in it. I am thinking to add events to it, but im not that great at them yet. When i call this class into form1 I basically change some values inside class, and the "object" that represents it, will add value or change color or change position ,etc. If i have a game let's say, when the character stays and I want him to look like it's breathing, this property should be inside the class? or outside, letting me choose when to breathe, how much, how long, how fast,etc. It's just an example. I had a lot of similar (and more complex) encounters with this subject and I simply freeze in the middle of it, not knowing how to manage it anymore. Both ways are good! From outside or from inside class. But... sometime i need maneuverability, sometime is just in the way and i want it 'there' behind some close door(inside class I mean). What your rules say about this thing? Should I change its values from inside the class? Or from outside? Thank you. ------ thanks to OriginalGriff i relocated here the question.

          q12

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Your character (class) could have a "Timer" that regulates breathing (and maybe another "ticker" for a heart). Then you can "attach" (using "component composition") an air supply to your character. Inside the air supply, you can have another timer so that eventually the air "runs out". You can attach a "progress bar" (another component) to your character that goes to blue as air runs out. Think "components"; and how to build more complicated components and scenarios from them.

          "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups