[library] bump.lua v3.1.4 - Collision Detection

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by kikito »

mm.

As I imagined, you are quite confused :nyu:

The main problem is that you are creating all the tiles every time you draw. That is not necessary.

Create them once at the beginning - for example inside game:enter. On the draw, just draw. Don't create anything.

Edit: Also, just to clarify: bump is not part of hump (you put it inside, and it took me a while to find out where it was :))
When I write def I mean function.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by Jasoco »

Well I decided to try and implement a slope method I had been thinking of for a while just to see if it worked...



It doesn't really.

Basically i just created 16 separate collision objects with a type of "slope", one for each pixel of a tile size, and when the player detects one on its X normal it just moves the Y position up 1.

Sadly it doesn't work as well as I thought. At least not this way.

I'd really rather just have an official method using that method you were working on a while ago. I don't even know how I'd make this work from here.
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by TheMeq »

kikito wrote:mm.

As I imagined, you are quite confused :nyu:

The main problem is that you are creating all the tiles every time you draw. That is not necessary.

Create them once at the beginning - for example inside game:enter. On the draw, just draw. Don't create anything.

Edit: Also, just to clarify: bump is not part of hump (you put it inside, and it took me a while to find out where it was :))
That was it! Fixed it all up and put it in Game:enter, problem solved! Thanks!

Also, I know bump isn't part of hump, I just dropped it in there so the libraries are all together, just not renamed my libraries folder yet :)
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by davisdude »

Jasoco wrote:Basically i just created 16 separate collision objects with a type of "slope", one for each pixel of a tile size, and when the player detects one on its X normal it just moves the Y position up 1.

Sadly it doesn't work as well as I thought. At least not this way.
Just a thought:
You could make the player's movement a vector, and project that vector onto a vector of the slope of the tile, and move the player up that vector. I think this would work, although you might encounter some problems if you have different slopes or something.

Again, this may (probably) won't work, but you could give it a try.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by kikito »

Jasoco wrote: I'd really rather just have an official method using that method you were working on a while ago. I don't even know how I'd make this work from here.
Yeah, it's on my todo list. I wanted to do it during the Summer, but I changed to a new job which has required all my programming juices for a while. It's a bit better now, so I have been able to start working on pending issues, pull requests, etc, on several of my projects.

I don't enjoy working in bump that much :| . Since I am not particularly math-inclined, every time I need to program mathy stuff I get quite frustrated. So I have to gather my energies first. But I did not forget about the slopes.

Also, one month ago I started playing XCOM: The Long War. OMG it's so good

EDIT: to recall: My idea was adding 4 new "collision types". In addition of "slice", "cross", etc, you would have "◢", "◣", "◤" and "◥" (the unicode name is provisional). In theory, it's as simple as writing 4 new functions. In theory.
When I write def I mean function.
User avatar
NightKawata
Party member
Posts: 294
Joined: Tue Jan 01, 2013 9:18 pm
Location: Cyberspace, Room 6502
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by NightKawata »

kikito wrote:
Jasoco wrote: I'd really rather just have an official method using that method you were working on a while ago. I don't even know how I'd make this work from here.
Yeah, it's on my todo list. I wanted to do it during the Summer, but I changed to a new job which has required all my programming juices for a while. It's a bit better now, so I have been able to start working on pending issues, pull requests, etc, on several of my projects.

I don't enjoy working in bump that much :| . Since I am not particularly math-inclined, every time I need to program mathy stuff I get quite frustrated. So I have to gather my energies first. But I did not forget about the slopes.

Also, one month ago I started playing XCOM: The Long War. OMG it's so good

EDIT: to recall: My idea was adding 4 new "collision types". In addition of "slice", "cross", etc, you would have "◢", "◣", "◤" and "◥" (the unicode name is provisional). In theory, it's as simple as writing 4 new functions. In theory.
Is "slice" one of the new modes? That one sounds pretty interesting, or I'm just out of the bump update cycle.
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by Jasoco »

kikito wrote:EDIT: to recall: My idea was adding 4 new "collision types". In addition of "slice", "cross", etc, you would have "◢", "◣", "◤" and "◥" (the unicode name is provisional). In theory, it's as simple as writing 4 new functions. In theory.
The day you implement something slope related is the day you become my hero.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by kikito »

NightKawata wrote:Is "slice" one of the new modes? That one sounds pretty interesting, or I'm just out of the bump update cycle.
Sorry, that was a typo, I meant "slide".
When I write def I mean function.
User avatar
NightKawata
Party member
Posts: 294
Joined: Tue Jan 01, 2013 9:18 pm
Location: Cyberspace, Room 6502
Contact:

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by NightKawata »

kikito wrote:
NightKawata wrote:Is "slice" one of the new modes? That one sounds pretty interesting, or I'm just out of the bump update cycle.
Sorry, that was a typo, I meant "slide".
Image
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: [library] bump.lua v3.1.4 - Collision Detection

Post by Kasperelo »

So, if I want to add enemies to my game, I add them to the world, but what do I do if I want the player to be able to pass through the enemy? Of course I want them both to collide with the other objects in the world.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests