char().gravity, .jmpforce

Description: Have any suggestions or new ideas for SMBX-38A? This is a place for you. Good suggestions may appear in future versions of SMBX-38A.
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

Lx Xzit M
Topic author, Moderator
Moderator
Avatar
Lx Xzit M
Topic author, Moderator
Moderator
Reputation: 399
Posts: 753
Joined: 9 Nov 2015
Website

Post #1by Lx Xzit » 29 Apr 2020, 10:11

I'd like to suggest two properties for players: Gravity and Jmpforce.

Gravity:
This property controls the player's fall speed acceleration. Currently we can counter it by subtracting the gravity of the player on every frame (For example Mario has a gravity of 0.4, so subtracting it 0.4 every frame will make him float). However, it sometimes makes coding a bit messy when you want to create your very own physics (for example, custom flying or swimming mechanics). So I believe this property would be a good addition.
Default value would be -1 which stands to the default player's gravity (i.e disabled), any other value greater than 0 would stand for the custom gravity.

Jmpforce:
This value consist on a timer that counts how many frames the player is able to gain height (when pressing jump and spin-jump). This value is to replicate the vanilla jumping mechanics (when you jump, spin-jump or bounce).
Since this value consist on a timer, if its greater than 0 it will decrease every frame. Also if > 0, as long as the player is pressing jump (and/or spin-jump) key, they will be able to keep gaining height. If at any moment the player unpress both jump and spin-jump keys, or collided with the ceil, the timer will reset to 0 (it's default value).

Special case:
I'd also wish that if this value was set to -1, it would 'cut' the players jump (If for example Mario is able to gain height the first 20 frames of this jump, and in the 10th frame this value was set to -1, he will no longer be able to keep gaining height). If the value was -1 and the player stomped or landed (it's ysp < 0 or .stand=1), it will set back to 0. (Currently we have no way to stop players jump aside from disabling all inputs from all players at the same time, which is not practical at all and causes several problems.)

This value would be very useful for creating normal bouncing physics on custom NPCs, without having the do to that tedious work. And in fact, in LunaLua this exact same property exists and it's pretty useful!
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

NESTED ERNEST M
Count
Count
Avatar
NESTED ERNEST M
Count
Count
Reputation: 71
Posts: 261
Joined: 23 Sep 2017
Location: Perú, Lima
Website

Post #2by NESTED ERNEST » 29 Apr 2020, 20:43

I can be wrong; or also char(x).gravity can take only 1 or 0: 1 to activate standard gravity and 0 to not execute standard gravity, and to put our gravity we would use char (1) .ysp+= 0.26 in the same way that the npc are programmed; and maybe with this you can have gravity on the ceiling (of course ignoring the sprites by custom playable)

And we ourselves create the variable that counts the frames that the player can gain momentum from the height or things like that: this would be the "Jmpforce".
Programming NPCs in SMBX-38A is fun:
That is me
Image
Image
Image
Image

ROCKMAN GIF IN SMBX 38A

Image

Lx Xzit M
Topic author, Moderator
Moderator
Avatar
Lx Xzit M
Topic author, Moderator
Moderator
Reputation: 399
Posts: 753
Joined: 9 Nov 2015
Website

Post #3by Lx Xzit » 29 Apr 2020, 23:54

NESTED ERNEST wrote:I can be wrong; or also char(x).gravity can take only 1 or 0: 1 to activate standard gravity and 0 to not execute standard gravity, and to put our gravity we would use char (1) .ysp+= 0.26 in the same way that the npc are programmed; and maybe with this you can have gravity on the ceiling (of course ignoring the sprites by custom playable)


It would be another way to implement it, but then if a beginner wants to change players gravity he/she should learn control flow, how to limit the players speed and a bit of how physics work, instead of using a single line of code. There also could be side effects if the player landed and still gain speed, so the implementation would be a little harder than that. I prefer if it's implemented in a more vanilla-friendly way.

As for recreating upside down physics, it would be the same as setting the gravity to 0 and add the acceleration by your own.

NESTED ERNEST wrote:And we ourselves create the variable that counts the frames that the player can gain momentum from the height or things like that: this would be the "Jmpforce".

Gravity and Jmpforce both have completely different purposes. Please don't confuse one with the other. Jmpforce is a way to recreating vanilla jump gain, not for work alongside gravity.
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

NESTED ERNEST M
Count
Count
Avatar
NESTED ERNEST M
Count
Count
Reputation: 71
Posts: 261
Joined: 23 Sep 2017
Location: Perú, Lima
Website

Post #4by NESTED ERNEST » 3 May 2020, 0:54

What is vanilla jump?
Programming NPCs in SMBX-38A is fun:
That is me
Image
Image
Image
Image

ROCKMAN GIF IN SMBX 38A

Image


Return to “Ideas & Suggestions”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest