Skip to content

Change API #18

@thomas-alrek

Description

@thomas-alrek

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions