BUMP Lib platformer help

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

BUMP Lib platformer help

Post 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 151 times
zerocoolisgod
Prole
Posts: 28
Joined: Fri Jan 22, 2016 2:48 am

Re: BUMP Lib platformer help

Post 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
User avatar
pgimeno
Party member
Posts: 3673
Joined: Sun Oct 18, 2015 2:58 pm

Re: BUMP Lib platformer help

Post by pgimeno »

I know it wasn't your actual intention, but I find that stickiness fun :nyu:
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

Re: BUMP Lib platformer help

Post 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!
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

Re: BUMP Lib platformer help

Post 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.
Garb
Prole
Posts: 29
Joined: Fri Aug 05, 2011 8:47 pm

Re: BUMP Lib platformer help

Post 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?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests