csanyk
Member
iMprOVE_WRAP is a paid extension that improves on the built-in GML function move_wrap.
The GML function move_wrap() is a useful GML function, but it has a few limitations:
Full documentation at: https://goo.gl/7DQaUZ
https://marketplace.yoyogames.com/assets/2216/improve_wrap
Please review it if you give it a try!
The GML function move_wrap() is a useful GML function, but it has a few limitations:
- It’s limited to working with the border of the room.
- Being a move_ function, it is based on GML’s built-in movement variables, so if you don’t use speed (or hspeed and vspeed) to move your object, it doesn’t work at all.
- Objects that are going off the edge of the room do not have their sprite start to draw at the other edge until the instance moves past border by the margin, at which point it disappears immediately from the edge of the room it’s leaving, making its appearance at the other end of the room very sudden.
- You have complete control to define a rectangular region within the room that the instance should wrap around. This allows you to define an arbitrary range for the object to wrap around that is not limited to the borders of the room. You can use the boundaries of the room just like move_wrap(), but you can also use the borders of a view, instead, or of an arbitrary region within your room (or even outside of your room, although you wouldn’t be able to see it.)
- Wrapping is based on position, not motion. If the instance’s x and y variables are outside of the defined range that you set up, the function will “wrap” the position around the defined range, using mod math to reposition it. This allows it to work with whatever variables you want to use for movement, whether they be the built-in GML speed variables, or variables that you define.
- Independent horizontal and vertical margins. Move_wrap() only has one parameter for margin; iMprOVE_WRAP has separate parameters for horizontal and vertical margin, to allow greater flexibility. Very helpful if your object’s sprite isn’t square in proportions.
- Drawing on both sides of the wrap boundary. With move_wrap(), the instance does not appear at the opposite side of the room until its position changes. This can lead to a jarring effect if a large or slow-moving sprite slowly reaches the wrap boundary, and then suddenly appears on the opposite side, rather than gradually emerging. iMprOVE_WRAP enhances the effect by allowing you to optionally drawing four “phantom” selves, at the points +/- range_height and range_width away from the true location of the instance, you can create the illusion of the instance’s sprite wrapping around, appearing on both edges of the defined range.
- Collisions can (optionally) be checked at the positions of the “phantom” sprites. In case it is necessary in your game; recommended if you’re using the phantom sprites, since otherwise they will not collide with things.
Full documentation at: https://goo.gl/7DQaUZ
https://marketplace.yoyogames.com/assets/2216/improve_wrap
Please review it if you give it a try!
Last edited: