How to use bump.lua

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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: How to use bump.lua

Post by Robin »

kikito wrote:You could, for example, only allow integer coordinates in your players (so they can be in 163 or 164, but never in 163.819283). You can also try a combination of both.
I would not suggest that. I would suggest keeping the player on the grid, and animating the players when they move from cell to cell, like in every other version of this game I've seen. In which case, you don't really need collision detection, just something simpler to check for walls and stuff.

So yeah, that or a smaller player.
Help us help you: attach a .love.
Bindie
Party member
Posts: 151
Joined: Fri Jan 23, 2015 1:29 pm

Re: How to use bump.lua

Post by Bindie »

Kikito: Right, actually the integer solution works fine, and I scaled down the players to 60x60.

Robin: Animating tile to tile, I would like to know more.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: How to use bump.lua

Post by kikito »

Robin wrote:In which case, you don't really need collision detection, just something simpler to check for walls and stuff.
Yes, I forgot to mention that too. In a bomberman style game, your movement is restricted (I think - I have not played that for years).

With the movement restrictions, you don't need a collision detection like bump. You can use the map itself, because the players only "occupy" one tile on each frame. So before moving to the left, you just have to ask "is the cell to my left free"? And allow movement only in that case.

To implement movement restrictions, you have to make your player "commit" to a movement. If you are in one cell and you press "left", the player will keep moving horizontally until you reach the center of the next cell. You can't move "up" or "down", even if they are empty too (you might allow moving back to the right). Once the next center is reached, the player is free to choose another direction. The player is always "aligned with the center of the tiles", at least in one axis. "The cell where the player is standing" is decided by looking at the point in the center of the player's feet.

Doing this in LÖVE is a bit tricky because of dt. If the "center" of a tile is at x=10, in one frame you can be at x=9.55 and on the next one you are at x=10.01, so you have to know "I am moving right and the player is not pressing right any more, so I will stop at x=10 instead of x=10.01".

You don't need to restrict your movement like that if you use bump (but you need to make the player smaller). It won't be exactly like the classical bomberman, but it will also be easier to program IMHO. Your players can be in 4 tiles simultaneously, which would make the kills a bit more realistic too.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: How to use bump.lua

Post by Robin »

Basically, you have the internal position, and the position on screen. The former changes when pressing keys, and stays on the grid. The position on screen is updated every frame, so that the player smoothly moves to the actual position.

There are tweening libraries (including one by kikito) that make that easier (and you can also choose how the speed changes, so if it stays the same, or if players accelerate and decelerate over the course of a transition).

You also might want to keep the previous internal position while the position on screen hasn't caught up, so that you can get caught in the blast of a bomb even if you just started moving to another square.
Help us help you: attach a .love.
Bindie
Party member
Posts: 151
Joined: Fri Jan 23, 2015 1:29 pm

Re: How to use bump.lua

Post by Bindie »

Aha, cool.
You also might want to keep the previous internal position while the position on screen hasn't caught up, so that you can get caught in the blast of a bomb even if you just started moving to another square.
Exactly, that was tricky to comprehend.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to use bump.lua

Post by zorg »

Robin wrote:...I would suggest keeping the player on the grid, and animating the players when they move from cell to cell, like in every other version of this game I've seen. ...
Just wanted to point out, that the TG-16 and DOS versions of the '91/'92 and '93/'94 versions of Bomberman / Dyna Blaster had that restriction in place only for mobs; the player could stop between tiles as well, and in the former game's case (that i remember), could also do "cornering", i.e. turning early to a perpendicular direction. (don't know how it was implemented though, probably with logic instead of an octagonal bounding box though)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Neito
Prole
Posts: 21
Joined: Sat Jul 09, 2022 9:00 pm

Re: How to use bump.lua

Post by Neito »

I'm trying to make a Super Mario World-style game but right now I've kind of made a mess of things and I would like to start again.
Is there any suitable template for me to build off of?
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: How to use bump.lua

Post by GVovkiv »

Neito wrote: Tue Nov 22, 2022 8:48 pm I'm trying to make a Super Mario World-style game but right now I've kind of made a mess of things and I would like to start again.
Is there any suitable template for me to build off of?
to start again.
You probably don't want to do so.
First, it would be good to teach yourself how to fix existing things, instead of rewriting them. Not every problem should be fixed by nuking everything and starting again.
2nd, you can easy catch yourself in "things become messy, i should rewrite it" loop and burn out because of this.

Well, unless you have some 40 years old codebase that filled with so many hacks, bugs, undocumented behaviours, old design decisions, etc. Then, yeah, probably rewriting will be easier...
Neito
Prole
Posts: 21
Joined: Sat Jul 09, 2022 9:00 pm

Re: How to use bump.lua

Post by Neito »

What should I do, how dow I make it like Super Mario World?
MrFariator
Party member
Posts: 559
Joined: Wed Oct 05, 2016 11:53 am

Re: How to use bump.lua

Post by MrFariator »

First question is, do you need slopes? Everything else is trivial.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 7 guests