Gravity behavior

I’m pretty sure lots of people tried to make water once in their platformer games. Well, all behavior logics I’ve seen in those games suck. So we really need a gravity behavior. It’s easy, the behavior changes the object’s gravity. It has an x and y input, two outputs which return the value and no properties.

Example how to make water:
You can make water by decreasing the y gravity with an easing to a low negative number so it’s like you float up when you go into the water. When you press down while swimming it will increase your gravity to a positive number so you’ll slowly go down. I’m pretty sure this will work perfectly :slight_smile:

Edit: oh and of course, always mention @grazer

Agreed

I want to make water in Cube’s Adventure so that’s why I want it :slight_smile:

Oh and, with an extractor you can get the gravity value of an object. There’s also another input in the gravity behavior to set it to the default gravity (from game settings).

It’s called velocity. I don’t use gravity. Gravity is the worst feature in the game, it’s only good for beginners. I can’t remember, but I want to say -30 is equal to 30 gravity. Connect an always to that. Have a collision with water set the -30 to -15/-20, so you sink slower, and slow your movement speeds by 3. I’ve made plenty of clean working games with this. If you want free swimming instead of Mario swimming, set velocity to -5/-10. You’ll still eventually drift downward, but you can use up/down/left/right as velocity keys with a swim animation, so you can swim in any direction. Have some kind of invisible air block spread around outside of the water that sets your controls back to normal, so you can jump out of the water. Gravity is just Velocity, but velocity has more customization. You can even flip the numbers around for X and Y, so you can walk on walls or make a gravity guy game. I did. It was one of my first games.

@“Mhx Ar” the Y axis flipped, so now negative numbers go up

@jngthree is that so? Negative numbers usually mean down or left on the grid, but impulse, velocity and motor work differently.

I just confused myself. Lol

I’m pretty sure it’s more efficient to use the gravity behavior instead of the velocity behavior to make water. I don’t want an always trigger connected to a velocity just to move the character up. Lots of things would be much easier to make with a gravity behavior, and it’s better for new users. Like jumping upside down when the default gravity is positive.

“it’s only good for beginners”

I only care about this

My second game I made when I joined involved flipping gravity so I could jump upside down off the ceiling. I used spacebar to set the velocity to the opposite number with a toggle switch. Every time I hit spacebar, I’d fall up, or fall down. @grazer is an always connected to velocity not the same as gravity?

Depends- because then you’ll always fall at the same rate

You always fall at the same rate with gravity, too. It’s a set number. The difference is that you can change the number for velocity, so you can walk on walls and stuff. See, here’s where velocity beats gravity. You can have all your enemies fall at different speeds. Bigger enemies have heavier velocity, flying enemies have almost no vertical velocity, but increased horizontal velocity. Your player can have changed velocity, depending on the situation. The node for gravity affects everyone and everything, not just the player. That means a bus would fall at the same speed as a feather in your game, and that is bad. Velocity is much better, but just not for beginners.

mhx- things fall at the same speed in real life too. It’s just one has more air resistance, is lighter, etc.

Objects that are said to be undergoing free fall, are not encountering a significant force of air resistance; they are falling under the sole influence of gravity. Under such conditions, all objects will fall with the same rate of acceleration, regardless of their mass.

But they pick up speed as they fall

Well I’ve heard enough. Now I want @grazer to confirm if velocity is the same as gravity.

So I can make my water

@jngthree I’m aware of that. I’ve seen the Vacuum Room at NASA where cars actually did fall at the same speed as feathers. However, you can’t easily simulate wind resistance in flowlab. I mean, you can, sure, have a full screen UI object animate wind, and as it animates, certain objects get a motor effect, but I was just demonstrating how different sized objects would benefit from different velocity instead of gravity. The game doesn’t know if your object is a tank or a pillow, so it will always fall whatever you set gravity to.

Isn’t motor like gravity? I think velocity always moves at the same pace.

@Luminous700 that’s my point