Action: Moverandx(target, min, max)

Related Actions: move, moveto, movebyx, movebyy, movetorand, moverandy, restrictx, restricty, letinitx, letinity, letobjectx, letobjecty
See also: FKiSS, Events, Actions

moverandx(target, min, max)

First defined in: FKiSS2.1
The moverandx action causes target to move by a random horizontal distance in the range min to max relative to its current position. The vertical position of target is not affected. Positive values move target to the right while negative values move target to the left.
FKiSS movement is restricted to the play field unless restrictx or
restricty is used to alter the limits for an object.

target

In FKiSS2.1 to FKiSS3, target must be an object number.
In FKiSS4, target may be an object number or a variable representing an object number.

min

In FKiSS2.1, min must be a number.
In FKiSS3, min may be number or a variable.

max

In FKiSS2.1, max must be a number.
In FKiSS3, max may be number or a variable.

Example:

;@ moverandx(#5, 5, 105)        ; Move object #5 to the right anywhere between 5 and 105 pixels.
;@ moverandx(#5, -5, -105)      ; Move object #5 to the left anywhere between 5 and 105 pixels.
;@ moverandx(VarObj, Low, High) ; Move object identified by variable VarObj horizontally in the range from Low to High.