Move actions
The first set of actions consists of those related to movement of objects.The following actions exist:
Move Fixed
Use this action to start the instance moving in a particular direction.You can indicate the direction using the buttons with the arrows on it.Use the middle button to stop the motion. Also you need to specifythe speed of the motion. This speed is given in pixels per step.Preferably don't use negative speeds.You can specify multiple directions. In this case a random choice is made.In this way you can let a monster start moving either left or right.
Move Free
This is the second way to specify a motion. Here you can indicate a precise direction.This is an angle between 0 and 360 degrees. 0 means to the right.The direction is counter-clockwise. So for example 90 indicates anupward direction. If you want an arbitrary direction, you can typerandom(360). As you will see below the function random givesa random number smaller than the indicated value. As you might have noticed thereis a checkbox labeled Relative. If you check this, the new motion is addedto the previous one. For example, if the instance is moving upwards and youadd some motion to the left, the new motion will be upwards to the left.
Move Towards
This action gives a third way to specify a motion. You indicate a position anda speed and the instance starts moving with the speed towards the position.(It won't stop at the position!) For example, if you want a bullet to flytowards the position of the spaceship you can use as position spaceship.x, spaceship.y.(You will learn more about the use of variables like these below.)If you check the Relative box, you specify the position relativeto the current position of the instance. (The speed is not taken relatively!)
Speed Horizontal
The speed of an instance consists of a horizontal part and a vertical part.With this action you can change the horizontal speed. A positive horizontalspeed means a motion to the right. A negative one means a motion to the left.The vertical speed will remain the same. Use relative to increase the horizontal speed(or decrease it by providing a negative number).
Speed Vertical
In a similar way, with this action you can change the vertical speed of the instance.
Set Gravity
With this action you can create gravity for this particular object.You specify a direction (angle between 0 and 360 degrees) and a speed,and in each step this amount of speed in the given direction is addedto the current motion of the object instance. Normally you need a verysmall speed increment (like 0.01). Typically you want a downward direction(270 degrees). If you check the Relative box you increase thegravity speed and direction. Note that, contrary to real life,different object can have different gravity directions.
Reverse Horizontal
With this action you reverse the horizontal motion of the instance.This can for example be used when the object collides with a vertical wall.
Reverse Vertical
With this action you reverse the vertical motion of the instance.This can for example be used when the object collides with a horizontal wall.
Set Friction
Friction slows down the instances when they move. You specify the amountof friction. In each step this amount is subtracted from the speeduntil the speed becomes 0. Normally you want a very small number here (like 0.01).
Jump to Position
Using this action you can place the instance in a particular position.You simply specify the x- and y-coordinate, and the instance is placedwith its reference point on that position. If you check the Relative box,the position is relative to the current position of the instance.This action is often used to continuously move an instance.In each step we increment the position a bit.
Jump to Start
This action places the instance back at the position where it was created.
Jump to Random
This action moves the instance to a random position in the room.Only positions are chosen where the instance does not intersect anysolid instance. You can specify the snapping used. If you specifypositive values, the coordinates chosen with be integer multiples ofthe indicated values. This could for example be used to keep the instancealigned with the cells in your game (if any). You can specify a separatehorizontal snapping and vertical snapping.
Align to Grid
With this action you can round the position of the instance to a grid.You can indicate both the horizontal and vertical snapping value (that is,the size of the cells of the grid). This can be very useful to make surethat instances stay on a grid.
Wrap Screen
With this action you can let an instance wrap around, that is, whenit leaves on one side of the room it reappears at the other side. Thisaction is normally used in the Outside event. Note that theinstance must have a speed for wrapping to work, cause the directionof wrapping is based on the direction of the motion. You can indicatewhether to wrap only horizontal, only vertical, or in both directions.
Move to Contact
With this action you can move the instance in a given direction until acontact position with an object is reached. If there already is a collisionat the current position the instance is not moved. Otherwise, the instanceis placed just before a collision occurs. You can specify the direction butalso a maximal distance to move. For example, when the instance is fallingyou can move a maximal distance down until an object is encountered. You canalso indicate whether to consider solid object only or all objects. You typicallyput this action in the collision event to make sure that the instance stopsin contact with the other instance involved in the collision.
Bounce
When you put this action in the collision event with some object, the instancebounces back from this object in a natural way. If you set the parameter preciseto false, only horizontal and vertical walls are treated correctly. When you setprecise to true also slanted (and even curved) walls are treated correctly.This is though slower. Also you can indicate whether to bounce only against solidobjects or against all objects. Please realize that the bounce is not completelyaccurate because this depends on many properties. But in many situations theeffect is good enough.
« Actions | Main actions, set 1 »