You see, I am terribly new to this kind of stuff, Lua, LÖVE, Hardon Collider.. And I think this is kind of a noob question but..
I can use Hardon Collider to detect the collision, but I don't really know what to do next. I sincerely don't know how to make the character don't go through a wall and simply stand still if there's something blocking the way. I first tried getting the player's coordinates + the enemy/wall coordinates, and doing some stuff with it, but I am certain I messed up somewhere. So, my question is, how?
PS: If there is already any topic about this, sorry about this "repost"
Attaching a .rar file containing the folder:
Collision with Hardon Collider
- silvergene
- Prole
- Posts: 5
- Joined: Wed Nov 05, 2014 2:54 am
Collision with Hardon Collider
- Attachments
-
- hardonmove.rar
- Meh, completely newbie.
- (19.62 KiB) Downloaded 181 times
Hey, Listen! Don't be Saria, I didn't mean to Gerudo 'bout it..
- silvergene
- Prole
- Posts: 5
- Joined: Wed Nov 05, 2014 2:54 am
Re: Collision with Hardon Collider
Nevermind, I think I "technically" did it.
The problem is that the collision is not exact (I sometimes stay a few pixels away from the enemy).
Anyone know a way to fix that?
The problem is that the collision is not exact (I sometimes stay a few pixels away from the enemy).
Anyone know a way to fix that?
- Attachments
-
- hardonmove.rar
- lala
- (43.95 KiB) Downloaded 158 times
Hey, Listen! Don't be Saria, I didn't mean to Gerudo 'bout it..
- silvergene
- Prole
- Posts: 5
- Joined: Wed Nov 05, 2014 2:54 am
Re: Collision with Hardon Collider
BTW, how do I load sprites into the shapes? :p
Hey, Listen! Don't be Saria, I didn't mean to Gerudo 'bout it..
Re: Collision with Hardon Collider
I've never used it before, but check out the tutorial. It handles several things, such as collision response (although it was never finished).
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
- silvergene
- Prole
- Posts: 5
- Joined: Wed Nov 05, 2014 2:54 am
Re: Collision with Hardon Collider
'Kay, now another quick question (I still wanna know how to add sprites to shapes), how to make melee weapons? I think I am kind of abusing in terms of asking question in a single thread, but seriously, I have no idea.
Hey, Listen! Don't be Saria, I didn't mean to Gerudo 'bout it..
Re: Collision with Hardon Collider
I don't think you can assign sprites to objects, the fill function of hardoncollider is for debugging purposes. What you can do is load an image, then draw it instead of the shape but simply use the coordinates of the shape for the coordinates of the sprite.
I'm not sure what you did wrong for the collision, but I made some smoother collision detection in the file provided. It works by working out where where the player will move to if an arrow is pressed, then it moves the player shape to that position and checks if it collides with anything. If it collides then the object will go back to the position it was in before it moved, and the player doesn't move. If it doesn't collide then the player moves to that space.
I'm not sure what you did wrong for the collision, but I made some smoother collision detection in the file provided. It works by working out where where the player will move to if an arrow is pressed, then it moves the player shape to that position and checks if it collides with anything. If it collides then the object will go back to the position it was in before it moved, and the player doesn't move. If it doesn't collide then the player moves to that space.
- Attachments
-
- hardonmove_fixed.rar
- (47.06 KiB) Downloaded 156 times
- silvergene
- Prole
- Posts: 5
- Joined: Wed Nov 05, 2014 2:54 am
Re: Collision with Hardon Collider
Yea, thanks for the help
Still am a newbie, so I am kind of struggling to understand the code, but I think i got most of it
Now, I tried to make some attack mechanics, but I am having a little trouble.
So, I wanted to kind of.. generalize the attack function, because right now it only works if I add a certain "property" to each of the polygons I create, and having to also call that certain particular "property" on the attack, if you get what I am saying.
The code is kind of a mess, sorrey
If you can help, thanks in advance!
Still am a newbie, so I am kind of struggling to understand the code, but I think i got most of it
Now, I tried to make some attack mechanics, but I am having a little trouble.
So, I wanted to kind of.. generalize the attack function, because right now it only works if I add a certain "property" to each of the polygons I create, and having to also call that certain particular "property" on the attack, if you get what I am saying.
The code is kind of a mess, sorrey
If you can help, thanks in advance!
- Attachments
-
- hardonmove1.love
- (297.09 KiB) Downloaded 164 times
Hey, Listen! Don't be Saria, I didn't mean to Gerudo 'bout it..
Re: Collision with Hardon Collider
I looked at it and modified it a bit, I hope my comments are enough for you to understand what I did. But basically, I really suggest you use tables and loops more when dealing with the enemies, as well as using x:collidesWith(y) instead of the on_collision function.silvergene wrote:Yea, thanks for the help
Still am a newbie, so I am kind of struggling to understand the code, but I think i got most of it
Now, I tried to make some attack mechanics, but I am having a little trouble.
So, I wanted to kind of.. generalize the attack function, because right now it only works if I add a certain "property" to each of the polygons I create, and having to also call that certain particular "property" on the attack, if you get what I am saying.
The code is kind of a mess, sorrey
If you can help, thanks in advance!
- Attachments
-
- hardonmove1_fixed.love
- (297.23 KiB) Downloaded 192 times
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest