This action is used to set the movement speed of the instance. The speed as calculated as the number of pixels that an instance has to move in a single game frame (step). By default the speed value will be added to the direction vector - so if you set speed to 2 and the direction to 45° the instance will move up and right 2 pixels every game frame - but you can also click on the direction field and select either Horizontal or Vertical speed. Choosing either of these will set the speed only for the horizontal or vertical vectors. Note that you can flag the value as being relative to the current speed, which will add or subtract the value from the actual speed of the instance, and you can also supply negative numbers, which will make it move in the opposite direction to the current direction value.
参数 描述 speed The speed value (can be negative).
The above action block code checks for a middle mouse press on the instance and if one is detected it sets the direction to down (270°) and the speed to 1 plus a random value from 0 to 1.