...only to avoid the hard numbers...
..in my example WindowWidth=640....in your capx WindowWidth is 1280
if you set variable(WWidh ) to WindowWidth. code like clamp(Self.X, WWidh-Self.Width, 0)
works in both cases..
and I noticed that if I use WWidh/2 instead of the WindowWidth /2 it litle lessl agging when i compare X