Jump to content


Photo

Character gets stuck on walls at low speeds.


  • Please log in to reply
4 replies to this topic

#1 Chris_Devl

Chris_Devl

    The Next Gabe Newell

  • GMC Member
  • 321 posts
  • Version:GM8

Posted 29 July 2012 - 06:04 PM

The movement works fine for anything more than 2 pixels per frame. Anything less than that, and the character gets stuck on wall sides.

if right
{
image_xscale = 1
image_speed = 0.3
if place_free(x + var_speed, y)
x = x + var_speed
else
move_contact_solid(0,var_speed)
}

if left
{
image_xscale = -1
image_speed = 0.3
if place_free(x - var_speed, y)
x = x - var_speed
else
move_contact_solid(180,var_speed)
}

Trying to jump in the opposite direction as the wall plays the jump animation but still doesn't move anywhere. Jumping while facing the wall will jump, but you still can't move horizontally unless you jump higher than the wall.
  • 0

#2 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1587 posts
  • Version:GM8.1

Posted 29 July 2012 - 08:06 PM

I'd say it's a problem with your collision mask. Make your collision mask independent of the direction the player is facing and independent of the animation playing. You should then be fine.
  • 0

#3 Chris_Devl

Chris_Devl

    The Next Gabe Newell

  • GMC Member
  • 321 posts
  • Version:GM8

Posted 29 July 2012 - 08:26 PM

I'd say it's a problem with your collision mask. Make your collision mask independent of the direction the player is facing and independent of the animation playing. You should then be fine.


I'm already doing that.
  • 0

#4 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1587 posts
  • Version:GM8.1

Posted 29 July 2012 - 10:07 PM

I'm already doing that.

No, you're not. image_xscale affects collision masks. Changing image_xscale to -1 will change the position of the mask, unless you got it perfectly symmetrical around the mask's origin (Unlikely). Try using something other than image_xscale (a variable you made for instance) and drawing the sprite yourself. Then you'll have collisions and graphics independent.
  • 0

#5 Kayle

Kayle

    GMC Member

  • GMC Member
  • 34 posts
  • Version:GM8

Posted 30 July 2012 - 03:50 PM

When I had this problem it was pretty much always that a collision mask was not centered on the origin correctly, or it was slightly too large.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users