reset password
Author Message
axu11
Posts: 4
Posted 11:53 Feb 09, 2020 |

The default NPC is initialized to (-999, -999) BUT the xPos and yPos can never be negative. So are we telling the default NPC to exist at (-999, -999) but not allowing it to move? Or are we supposed to have the setter "correct" the default values from -999 to 0? 

kknaur
Posts: 540
Posted 11:57 Feb 09, 2020 |

Use the default value as given.  Since the default values are set in the default constructor, you can set them to whatever you want for testing purposes.  Sometimes despite the fact that data fields may not be allowed to be set to a certain range of values when coming from an outside source, internally we may want to set them to an invalid value just to show that it is a test value or test object.  This is just an example of that.  When you see an NPC with a location -999, -999   you know that it is a test NPC and probably should not make it into the final game.  Using obviously incorrect values or "dummy data" can be an easy way to show that the value is just a starter value or some test data.