

#Gamemaker studio 2 path how to#
You would then use this function to tell your instance which path to follow, what speed to follow the path (measured in pixels per step), how to behave when it reaches the end of the path, and whether to follow the absolute or relative path position. They can be created with code, or in the Path Editor and they are assigned to an instance to use in the game.
#Gamemaker studio 2 path series#
The selected points as a group.A path is created from a series of defining points that are linked together and then used to plan the movements of an instance. You can press / and click on already placed points to select them, and then any operations done on the path points like moving them, will be applied to all It (you can set the detection distance for this in the Preferences).

If you place a point near a connecting line or another node, the new point will be inserted in the path rather than added to You can add points anywhere in the room editor and they will be added to the point list consecutively to make a path. In the editor, you place these points by using the left mouse button. Paths are simply a collection of points joined together by a line.
YouĬan use / and left click on multiple points to select them together, and this group of points can then be dragged around and placed as you require. Once placed in the editor a point can be moved byĬlicking and dragging on it or by changing the values presented to you on the left for the X and Y position and speed (see Path Properties, above). You can add points to the path clicking anywhere in the edit window, and all subsequent clicks will add further points. The image below shows an example of how these options affect the path: You can also specify the precision for the curves (default is 4) which can be from 1 to 8 with 8 being the The connection kind can be either straight line, or smooth whereĪ straight line connect simply connects the points of a path in a linear basis, with angular changes at each point, while a smooth connection will create a much softer path that may not pass directly through any of the points, but rather take anĪpproximate line, creating nice curves using smooth interpolation. You can also specify the connection kind for the whole path and whether the path should be closed or not (a closed path will connect the last point on the path with the first). The selected point, or slow double click on one of the values to edit it manually (x, y, or speed). It is worth noting that you can fast double click on any of the defined points in the list to pan the editor to
#Gamemaker studio 2 path code#
In this way you can create some nice dynamic looking movement without any code Equally, you can set the speed to 150% and the instance will accelerate as it reaches the point. So if you start an instance at a speed of 2 (2 pixels per step) along a path and then one of the path points has a speed value of 50%, the instance will reduce speedĪs it approaches this points to a speed of 1 (50% of the path speed). Of the speed at which you make the instance move along the path (default is 100%). Once you have named the path, you can start to define it by placing points in the main editor on the right, with each point being added to the list here along with its position and speed. The speed value for path points is defined by a percentage As with all resources in GameMaker you should give your new path a unique name as this is what will be used to identify it throughout the game you are making, and a good system that a lot of people use is to prefix (or suffix) the resourceįor easy recognition in code or actions (eg: path_Enemy_1 or PowerUp_path).
