gm-docs-parser 1.0.0

A collection of typings for GameMaker Studio 2 manual pages
Documentation
<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>

  <script type="text/javascript" language="JavaScript">
    //<![CDATA[
    function reDo() {
      if (innerWidth != origWidth || innerHeight != origHeight)
        location.reload();
    }
    if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
      origWidth = innerWidth;
      origHeight = innerHeight;
      onresize = reDo;
    }
    onerror = null;
  //]]>
  </script>
  <style type="text/css">/*<![CDATA[*/

    < !-- div.WebHelpPopupMenu {
      position: absolute;
      left: 0px;
      top: 0px;
      z-index: 4;
      visibility: hidden;
    }

    p.WebHelpNavBar {
      text-align: right;
    }

    -->
  
/*]]>*/</style>

  <script type="text/javascript">//<![CDATA[

    gRootRelPath = "../../../..";
    gCommonRootRelPath = "../../../..";
    gTopicId = "9.2.4.1";
  
//]]></script>

  <script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/common.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script>
<script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script>
  <link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"/>
  <link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"/>
  <meta name="topic-status" content="Draft"/>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Movement</title>
  <meta name="generator" content="Adobe RoboHelp 2019"/>
  <link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"/>
  <meta name="rh-authors" content="Mark Alexander"/>
  <meta name="topic-comment" content="Reference section for Movement functions and variables"/>
  <meta name="rh-index-keywords" content=""/>
  <meta name="search-keywords" content="movement functions,Movement"/>
</head>

<body>
  <div class="topic-header rh-hide" id="rh-topic-header" onclick="rh._.goToFullLayout()">
    <div class="logo">
    </div>
    <div class="nav">
      <div class="title" title="Movement">
        <span>Movement</span>
      </div>
      <div class="gotohome" title="Click here to see this page in full context">
        <span>Click here to see this page in full context</span>
      </div>
    </div>
  </div>
  <div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div>



  <!--<div class="body-scroll" style="top: 150px;">-->
  <h1>Movement</h1>
  <p>In any game, movement and position are of paramount importance and so GameMaker Studio 2 has a complete selection of functions to deal with every situation. The two main ways of moving an instance is to either set the
    actual position or to set a speed/direction vector, and this can be done either using the built in variables instance variables or to use specific movement functions. Both of these options are explained in the sections listed below:</p>
  <p>The following variables are all included &quot;built in&quot; to every instance and can be read and modified to change different behaviours when the instance is moving (they will affect the speed and direction vectors):</p>
  <p> </p>
  <ul class="colour">
    <li><a href="../../Asset_Management/Instances/Instance_Variables/direction.htm">direction</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/friction.htm">friction</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/gravity.htm">gravity</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/gravity_direction.htm">gravity_direction</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/hspeed.htm">hspeed</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/vspeed.htm">vspeed</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/speed.htm">speed</a></li>
  </ul>
  <p> </p>
  <p>Other than those variables mentioned above you can also set the instance position directly using the following:</p>
  <p> </p>
  <ul class="colour">
    <li><a href="../../Asset_Management/Instances/Instance_Variables/x.htm">x</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/y.htm">y</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/xprevious.htm">xprevious</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/yprevious.htm">yprevious</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/xstart.htm">xstart</a></li>
    <li><a href="../../Asset_Management/Instances/Instance_Variables/ystart.htm">ystart</a></li>
  </ul>
  <p> </p>
  <p>The following functions can all be used to move an instance in some way, with some affecting the speed/direction vectors and others affecting the actual x/y position within the room directly:</p>
  <p> </p>
  <ul class="colour">
    <li><a href="motion_add.htm">motion_add</a></li>
    <li><a href="motion_set.htm">motion_set</a></li>
    <li><a href="move_towards_point.htm">move_towards_point</a></li>
    <li><a href="move_bounce_all.htm">move_bounce_all</a></li>
    <li><a href="move_bounce_solid.htm">move_bounce_solid</a></li>
    <li><a href="move_contact_all.htm">move_contact_all</a></li>
    <li><a href="move_contact_solid.htm">move_contact_solid</a></li>
    <li><a href="move_outside_all.htm">move_outside_all</a></li>
    <li><a href="move_outside_solid.htm">move_outside_solid</a></li>
    <li><a href="move_random.htm">move_random</a></li>
    <li><a href="move_snap.htm">move_snap</a></li>
    <li><a href="move_wrap.htm">move_wrap</a></li>
    <li><a href="place_snapped.htm">place_snapped</a></li>
  </ul>
  <p> </p>
  <p> </p>
  <p> </p>
  <div class="footer">
    <div class="buttons">
      <div class="clear">
        <div style="float:left">Back: <a href="../Movement_And_Collisions.htm">Movement And Collisions</a></div>
        <div style="float:right">Next: <a href="../Motion_Planning/Motion_Planning.htm">Motion Planning</a></div>
      </div>
    </div>
    <h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
  </div>
  <!-- KEYWORDS
Movement
-->
  <!-- TAGS
movement_functions
-->

</body></html>