3 replies [Last post]
Posts: 41

Hey guys (if there's anyone left)

TLDR; I feel like characters stay in the air too long while jumping and falling, and it makes characters seem like they're floating. What I would like to achieve is to make characters Jump higher, and fall down faster.

I toyed around with CharacterJumpVelocity and managed to change the character's jump height, but it seems to have a limit of -.048. Every number between -0.48 and 0 will change the height of the jump. The closer the value is to 0, the shorter the character will jump. If the value is set to 0, your character will be unable to jump (used for TopDown I think?) Any number lower than -.048 (i.e -0.9, -2.1) doesn't affect the Jump's height; It seems to stay at the same height.


As for Gravity and fall speed: I looked everywhere but didn't seem to find a value to modify that would affect the gravity. I found something about weight in entity.cs, but I don't know where the character's weight is determined. I'm 100% clueless about how Gravity works in NetGore.

        /// <summary>
        /// Gets or sets the weight of the Entity (used in gravity calculations).
        /// </summary>
        [Description("The weight of the Entity. Higher the weight, the greater the effects of the gravity, where 0 is unaffected by gravity.")]
        public virtual float Weight
            get { return _weight; }
            set { _weight = value; }

As stated in my TLDR, I need help increasing the Jump height limit, and increasing the speed at which your character falls. Any and all help regarding this topic is very appreciated!

Posts: 564

Hi NGAPA! Haha yea, there's still some of us around Laughing out loud Well, maybe only me and I'm quite absent for most of the time Tongue

Fair enough - very valid questions. I've not worked with the side-scrolling part of NetGore in a while but this doesn't seem too difficult to debug. I don't have access to the source right now but I'll try and help out and respond tomorrow.

Posts: 41

Hey DarkSummon! Good to hear from you again Smile. I kept looking into it and I think I'd have to edit MapBase.cs and/or EngineSettings.cs to change the gravity, but I'm not exactly sure what to change..

I feel like there should be a way to edit the map's gravity from the map editor Tongue

Posts: 564

Well I just had a quick look and first off, I didn't realise the side scrolling build of NetGore is broken Sad Meaning there isn't a default side scrolling map. Oh well, not a big deal I guess.

But yea, regarding your issue, you're correct - gravity doesn't seem to be manageable through the editor. You can obviously overcome this by opening the file directly, while the editor is closed.
However, if you want to play around with the default gravity, change the following code in EngineSettingsInitializer.cs:

        /// <summary>
        /// Initializes a new instance of the <see cref="EngineSettingsInitializer"/> class.
        /// </summary>
        EngineSettingsInitializer() : base(new Vector2(0f, 0.0009f), new Vector2(0.5f, 0.5f))

The "new Vector2(0f, 0.0009f)" part is the hardcoded default gravity by the looks of it.

Sorry I couldn't be much more use but that should get you on the right path Smile If you wanted to be extra good, add the gravity logic in the editor and commit said changes to the repository Laughing out loud