Cloud.cs

A small game component named Cloud that updates its world position each frame by applying a 2D velocity and applies simple deceleration to that velocity.

using Sandbox;
using System;

public sealed class Cloud : Component
{
	public Vector2 Velocity { get; set; }
	public float Deceleration { get; set; }

	protected override void OnUpdate()
	{
		WorldPosition += (Vector3)(Velocity * Time.Delta);
		Velocity *= Math.Max( 1f - Time.Delta * Deceleration, 0f );
		
		// todo: affected by wind
	}
}