Skip to content

Commit

Permalink
fixed move_wrap()
Browse files Browse the repository at this point in the history
  • Loading branch information
omicronrex committed Dec 8, 2024
1 parent c1aec21 commit 7f06df9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gm82core.gej
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"folder": "gm82",
"version": "1.6",
"author": "renex, Floogle, Lovey01, cam900, Adamcake, YellowAfterlife, Verve",
"date": "29/11/2024",
"date": "08/12/2024",
"license": "Free to use, also for commercial games.",
"description": "Part of the standard Game Maker 8.2 distribution. This extension package contains a number of helper functions that are commonly used, and also geometry functions introduced in GM:Studio. This extension is also required for using the other GM 8.2 extensions, Sound and Joystick.",
"helpfile": "",
Expand Down Expand Up @@ -2031,6 +2031,19 @@
],
"returntype": 2
},
{
"name": "move_wrap",
"extname": "",
"calltype": 2,
"helpline": "move_wrap(hor,vert,margin)",
"hidden": false,
"argtypes": [
2,
2,
2
],
"returntype": 2
},
{
"name": "outside_room",
"extname": "",
Expand Down
15 changes: 15 additions & 0 deletions source/instances.gml
Original file line number Diff line number Diff line change
Expand Up @@ -474,5 +474,20 @@
with (object_index) if (__gm82core_recurse) if (instance_place(x,y+1,other.id)) __gm82core_recursive_group_assign(argument0)

variable_local_set(argument0,global.__gm82core_groupid)


#define move_wrap
///move_wrap(hor,vert,margin)
var __margin;__margin=argument1
if (argument0) {
//horizontal
if (bbox_right+1<-__margin) x+=room_width+__margin-bbox_left
else if (bbox_left>room_width+__margin) x-=bbox_right+1+__margin
}
if (argument1) {
//vertical
if (bbox_bottom+1<-__margin) y+=room_height+__margin-bbox_top
else if (bbox_top>room_height+__margin) y-=bbox_bottom+1+__margin
}
//
//

0 comments on commit 7f06df9

Please sign in to comment.