Page 1 of 1

BUMP Lib platformer help

Posted: Tue Feb 16, 2016 7:15 pm
by Garb
hello I'm making a small platformer and I'm using kikito's bump for collisions.

It's going well however right now I can't get jumping right. The problem is that, you can jump up walls indefinitely. I'm trying to make it behave much more traditionally, as it should.

So how do I make the jump not stick to everything essentially?

Use arrows to move, x to jump

Thanks, I attached the love for reference.
Love 0.10.0 is necessary for it to work properly.
test.love
dont user older love versions
(12.84 KiB) Downloaded 149 times

Re: BUMP Lib platformer help

Posted: Tue Feb 16, 2016 9:24 pm
by zerocoolisgod
You are setting your y_velocity to zero and flipping your on_ground to True for EVERY collision. So when you are next to a wall, the game thinks you are on the ground. Instead do

Code: Select all

local actualX, actualY, cols, len = world:check(item, goalX, goalY, <filter>)
with goalY being 1 pixel below your current position. player.yvel = 0 only if that throws collisions.

Change:

Code: Select all

  for i=1,cols_len do
    player.yvel = 0
  end
To:

Code: Select all

  local actualX, actualY, cols, cl = world:check(player, player.x, player.y+1)
  for i=1,cl do
    player.yvel = 0
  end

Re: BUMP Lib platformer help

Posted: Tue Feb 16, 2016 10:10 pm
by pgimeno
I know it wasn't your actual intention, but I find that stickiness fun :nyu:

Re: BUMP Lib platformer help

Posted: Tue Feb 16, 2016 10:13 pm
by Garb
zerocoolisgod wrote:You are setting your y_velocity to zero and flipping your on_ground to True for EVERY collision. So when you are next to a wall, the game thinks you are on the ground. Instead do

Code: Select all

local actualX, actualY, cols, len = world:check(item, goalX, goalY, <filter>)
with goalY being 1 pixel below your current position. player.yvel = 0 only if that throws collisions.

Change:

Code: Select all

  for i=1,cols_len do
    player.yvel = 0
  end
To:

Code: Select all

  local actualX, actualY, cols, cl = world:check(player, player.x, player.y+1)
  for i=1,cl do
    player.yvel = 0
  end

Great, I see now. this was exactly what I needed, much thanks!

Re: BUMP Lib platformer help

Posted: Tue Feb 16, 2016 10:16 pm
by Garb
pgimeno wrote:I know it wasn't your actual intention, but I find that stickiness fun :nyu:
Haha, funny you say that I thought the same thing.

Re: BUMP Lib platformer help

Posted: Sat Feb 20, 2016 5:13 pm
by Garb
Here's an unrelated issue, I'm having a strange problems as a repercussion of my implementation of player velocity
Right now, when the player collides with anything it runs this code

Code: Select all

  local actualX, actualY, cols, poop = world:check(player, player.x, player.y+1)
  for i=1,poop do
    player.yvel = 0
    player.onGround = true

end
this makes the player move properly, however the issue is that if I set yvel to 0 then every time it touches an object set to cross, the player keeps having his yvel reset, so he very slowly moves through objects with the cross filter.

does anybody have any ideas on how I could make the cross filter work properly with my velocity?