Impuse vs Velocity

I don’t really understand the difference between impulse and velocity and motor. @JR01 ?

Also I’ve seen people (like JR01) use different words like “var” which I believe is variable in javascript, but idk how to use it. I’d like a list of these words and what they do. They aren’t in the help section.


Velocity sets an object’s speed directly, while Impulse and Motor just apply a force to an object, causing it to accelerate.


You can set values to a name in the expression by using var. I’ve used them in many bundles, but you use them like.

var Xspeed = A;
var Yspeed = B;
Xpeed + Yspeed

Here is a haxe list for math operators
Math - Haxe 4.3.1 API


So you can do everything with velocity if you want to? Like jumping?

Also both of you are solutions so…

1 Like

oh I think I get it. I was trying to understand your code. Here’s what it says in the expression:

var n1 = A+B;
var list = [400, 180, 0, 400, 270, 225, 315, 270, 90, 135, 45, 90, 400];

so it’s basicly just running the program you write in it?
So you declare a variable “n1” which is A+B, then declare a variable “list”, an array, and fill it up, then you output the "n1"th number of the “list”. I’ve done some programming.

That makes sense, but which line will it return the number? Does it just return the output of the last line? I’d assume so


Those variables just are set using those lines. You have to call upon them again in the expression to use them.

Basically JR codes using HAXE inside an expression


What exactly do you mean here? Nothing special, right? Just how variables work normally.


Looks like its one of my directional movement code (possibly from Witch?).

So the expression itself works like your making a function (which is a little ironic because you can make functions inside this function), but that means that the first line that makes an output will be the output.

For example, if you use return statement in your code, it will kill the expression and output the return value. And if you do math and not set it to a variable, it will output that math and kill the expression.

The one thing about expressions is that its not live code and resets once it outputs. So every eval input, it has to create those variables i made in the expression and run the code.


I see.

var n1 = A+B;
var list = [400, 180, 0, 400, 270, 225, 315, 270, 90, 135, 45, 90, 400];

Because the first two were just making the variables, so the last one is the one that is outputted.

Are you saying that you can also do it manually? Like this?

return list[n1];

This effects the runtime and efficiancy, right, nothing else.


list[n1] and return list[n1] should have the same results.
That line isn’t letting the expression move to the next line so that is the output there.