GameMaker: Studio

GameMaker: Studio

View Stats:
Crow Aug 13, 2016 @ 1:05pm
Player Stuck In Wall {SOLVED}
No, this is not the age old issue everyone knows, I've looked that up over and over but I can't find a fix for it. I use this code,
image_angle = point_direction(x, y, mouse_x, mouse_y);
in order to make the player rotate around towards the mouse. But no matter how much I alter the collision shape and mask, it always potentially gets stuck in the wallss. Does anyone know just what I'm supposed to do with the collision shapes and masks? If you do I'd be glad to see it.
Last edited by Crow; Aug 14, 2016 @ 11:40am
< >
Showing 1-11 of 11 comments
MinorThreat Aug 13, 2016 @ 1:16pm 
Have you tried making a different sprite that is just a circle that would fit inside of your player sprite and on you player object where it says mask right under where you choose the sprite select the mask that you made?
Crow Aug 13, 2016 @ 1:50pm 
I haven't tried that. I'll try that tomorrow and let you know if it works
SNSHunter Aug 13, 2016 @ 1:57pm 
yeah, the solution to this is to simply set the objects sprite to a collision box or circle you make and then draw the sprite you want in the draw event.

Anytime you have a moving object with a collision mask that changes you can run into a lot of issues.
Crow Aug 13, 2016 @ 2:13pm 
Originally posted by Negative Headed:
yeah, the solution to this is to simply set the objects sprite to a collision box or circle you make and then draw the sprite you want in the draw event.

Anytime you have a moving object with a collision mask that changes you can run into a lot of issues.
Well whenever I do that the player no longer rotates to the mouse.
Crow Aug 13, 2016 @ 2:15pm 
Originally posted by Stambimmy:
No, this is not the age old issue everyone knows, I've looked that up over and over but I can't find a fix for it. I use this code,
image_angle = point_direction(x, y, mouse_x, mouse_y);
in order to make the player rotate around towards the mouse. But no matter how much I alter the collision shape and mask, it always potentially gets stuck in the wallss. Does anyone know just what I'm supposed to do with the collision shapes and masks? If you do I'd be glad to see it.
Making that is gonna be hard since the sprite looks like this https://gyazo.com/2494274b52be1626ac3983a5d3f7b5fa
MinorThreat Aug 13, 2016 @ 2:43pm 
The sprite mask will be invisible. Just make it a circle.
SNSHunter Aug 13, 2016 @ 2:48pm 
yeah basically just make a sprite that is just a circle, set the object's sprite to that.

then in the draw event your going to use draw_sprite_ext() to draw the sprite you want the player to be. So like,

draw_sprite_ext(spr_player,0,x,y,1,1,point_direction(x, y, mouse_x, mouse_y),c_white,1)
MinorThreat Aug 13, 2016 @ 2:54pm 
You don't need to use the draw event though. You can set the sprite to the sprite you have and in the box below where you set the sprite you can choos the circle as the mask.
Takio Aug 13, 2016 @ 3:15pm 
A circle as collisionmask for the walls is the best option, since shapes with corners can always have one of them that can get stuck. But I think you can set another seperate collisionshape for different purposes.

I recommend the video on collision functions from Let's Learn GameMaker:Studio
https://www.youtube.com/watch?v=kQJdeZFcbLQ
Last edited by Takio; Aug 13, 2016 @ 3:16pm
SNSHunter Aug 13, 2016 @ 5:04pm 
Originally posted by MinorThreat:
You don't need to use the draw event though. You can set the sprite to the sprite you have and in the box below where you set the sprite you can choos the circle as the mask.
I've never messed with that function personally. Then again I do tend to need to use the draw event anyhow as I rarely don't layer and section my sprites...
Crow Aug 14, 2016 @ 11:40am 
Originally posted by Negative Headed:
yeah basically just make a sprite that is just a circle, set the object's sprite to that.

then in the draw event your going to use draw_sprite_ext() to draw the sprite you want the player to be. So like,

draw_sprite_ext(spr_player,0,x,y,1,1,point_direction(x, y, mouse_x, mouse_y),c_white,1)
It works! Thanks!
< >
Showing 1-11 of 11 comments
Per page: 1530 50

Date Posted: Aug 13, 2016 @ 1:05pm
Posts: 11