follow(obj: GameObj | null, offset?: Vec2): FollowComp
Follow another game obj's position.
param
obj- The game obj to follow.
param
offset- The offset to follow at.
const bean = add(...)
add([
sprite("bag"),
pos(),
follow(bean) // Follow bean's position
]);
// Using offset
const target = add(...)
const mark = add([
sprite("mark"),
pos(),
follow(target, vec2(32, 32)) // Follow target's position with an offset
])
mark.follow.offset = vec2(64, 64) // Change the offset
returns
The follow comp.
since
v2000.0
group
Components