No Revisions Have Been Made To This Page
Can you suggest an edit for this page? Click Here
GML Code Example
move_wrap(hor, vert, margin);
|hor||Whether to wrap horizontally (true) or not (false).|
|vert||Whether to wrap vertically (true) or not (false).|
|margin||How far outside the room, in pixels, the object must be to initiate wrapping.|
This function will automatically "wrap" an instance that has
left the room on either the horizontal or vertical (or both) axis.
You can specify a margin outside the edges of the room for this to
occur, and when the instance has travelled outside of that margin
GameMaker: Studio will automatically wrap it back into the
room at the other side. Note that the instance must have a speed
for wrapping to work, because the direction of wrapping is based on
the direction of the motion.
These examples are submitted by the community. Upvote the examples you think are most helpful.
Move Wrap by /u/tmcicuurd12b42 on January 19, 2017
///create motion_set(-35,8); ///step //wrap when completely outside the room, radius being 16 move_wrap(1, 1, 16); ///draw draw_circle(x,y,16,0); /* See It In Action: https://yal.cc/r/gml/?mode=undefined&lzgml=MQEwpgZglgdmAEBbAhrAUAeiwYwE5mQBcw1EB7QqMmAfQGcxCAKAWgGYBWAGgA4BKANxo0oSLAR1iAB0xZJYGVgDuuZFPhKAFmBjxsZRFIA2jMEYCe8MgFdCdKOHiFt8XGQNdXyEFGt14AEZgsADm8ACMAGykZABuYDQqakzhnqkRkYLCotBw8CCqSrIYBchFpUo0+NiEyDAhJkwADFwtbgaJDs5c7Yg02lAhmoRc4VkVNNhQuNiNAB5c5qORrVloQA */