You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be better to have the transform and vector2 methods apply to the object itself, instead of returning a new instance.
Example:
//This is how it is today, it is way to verbose
var player1 = new Sprite({image: "player.png"});
var target = new Vector2({x: 100, y: 100});
player1.transform.position = player1.transform.position.add(player1.transform.position.lerp(player1.transform.position, target, Time.deltaTime));
Instead, we could rewrite the API to work like this:
var player1 = new Sprite({image: "player.png"});
var target = new Vector2({x: 100, y: 100});
player1.transform.position.lerp(target, Time.deltaTime);
This would seriously simplify things. So the functions, like add(), multiply(), lerp(), etc. would work directly on the object instance itself.
The text was updated successfully, but these errors were encountered:
It would be better to have the transform and vector2 methods apply to the object itself, instead of returning a new instance.
Example:
Instead, we could rewrite the API to work like this:
This would seriously simplify things. So the functions, like add(), multiply(), lerp(), etc. would work directly on the object instance itself.
The text was updated successfully, but these errors were encountered: