• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows move_wrap Not Working?

O

Omega

Guest
I have my event as -other -outside room

code:

move_wrap(true, true, sprite_width);

everytime my cube flies out of the border it does not wrap.
 

Blaize

Member
As an alternative, do this instead:

Code:
//this is pseudocode

if (x>room_width)
     x = 0;
else if (x<0)
     x = room_width;
And then you do the same for the y-axis but with room height instead.
 
O

Omega

Guest
As an alternative, do this instead:

Code:
//this is pseudocode

if (x>room_width)
     x = 0;
else if (x<0)
     x = room_width;
And then you do the same for the y-axis but with room height instead.
Thank you so much for the fix, could you explain why this works instead of the other code, if you would be so kind :)
 

Blaize

Member
Thank you so much for the fix, could you explain why this works instead of the other code, if you would be so kind :)
Well, actually move_wrap works fine, it's just because you're running it from the outside room event when you should be using move_wrap in the step event.
What I showed you works by checking the origin of the object (actually the collision mask) and finding where it is in the room.
This way works because you're calling it from the outside room event, so it will check only when the object is outside of the room. Hope you understood it :)
 
O

Omega

Guest
Well, actually move_wrap works fine, it's just because you're running it from the outside room event when you should be using move_wrap in the step event.
What I showed you works by checking the origin of the object (actually the collision mask) and finding where it is in the room.
This way works because you're calling it from the outside room event, so it will check only when the object is outside of the room. Hope you understood it :)
Understand very well thank you for your response, i'm having a little issue with instance_destroy(); it's a bullet that should destroy an asteroid and its self how would i do that? my best try is here

Code:

instance_destroy();
with(other)

.

this all happens under the obj_bullet -><- collision event with enemy.
 
Understand very well thank you for your response, i'm having a little issue with instance_destroy(); it's a bullet that should destroy an asteroid and its self how would i do that? my best try is here

Code:

instance_destroy();
with(other)

.

this all happens under the obj_bullet -><- collision event with enemy.
With(other){instance_destroy()} <-Destroys the asteroid
instance_destroy(); <-Destroys itself
 
Top