i'm new on Love2d, and i'm doing my first game, is a simple game where a warrior walks rigth and left and attacks, the waarrior are two sprite, one for walk, another for attack, the enemie is a image, and goes from one side of the screem, to another, with no animation.
The problem is, how i make the colision of this two images? i had searched on the internet and try some things, but nothing work
If someane could help, i will be very very grateful.
i'm sending my code to, if helps
and very sorry for the bad english, is not my native language
thanks
Help with colision on LOVE2D
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 1
- Joined: Sun Jun 24, 2018 8:51 pm
Help with colision on LOVE2D
- Attachments
-
- main.lua
- (3.97 KiB) Downloaded 125 times
Re: Help with colision on LOVE2D
There are a ton of different ways you could do collision and what the best way to do it for you depends a lot on many different variables.
You could either use a library like BUMP (https://github.com/kikito/bump.lua)
Or you could use the build in Löve physics system (https://love2d.org/wiki/love.physics), this is what I personally prefer, but I feel like I am in the minority though.
Another alternative would be to use something like AABB collision that you code yourself. An example of this would be:
You could either use a library like BUMP (https://github.com/kikito/bump.lua)
Or you could use the build in Löve physics system (https://love2d.org/wiki/love.physics), this is what I personally prefer, but I feel like I am in the minority though.
Another alternative would be to use something like AABB collision that you code yourself. An example of this would be:
Code: Select all
if ax < bx + bw and ax + aw > bx and ay < by + bh and by < ay + ah then
--A and B are colliding
end
Who is online
Users browsing this forum: Google [Bot] and 3 guests