Hello, I'm sure you will have heard all this before but hear me out, I'm new to love2D and could use some help.
After about a week trying to find a good tutorial just to get started, but I'm lost i can't find a path to follow.
If some one could just show me were to start, i would be so grateful.
Best Regards
Rikky
Drowning in a sea of code Plz Help!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Mon Nov 10, 2014 2:02 pm
Re: Drowning in a sea of code Plz Help!
Thanks you
Tile set one was very helpful, Do you know of any good collision tutorials?
Re: Drowning in a sea of code Plz Help!
I do not have any tutorials but this should be helpful for you.
Simple collision:
Or this
This is only example, values can be not correct.
collision and table example:
Simple collision:
Code: Select all
function CheckCollision(ax1,ay1,aw,ah, bx1,by1,bw,bh)
local ax2,ay2,bx2,by2 = ax1 + aw, ay1 + ah, bx1 + bw, by1 + bh
return ax1 < bx2 and ax2 > bx1 and ay1 < by2 and ay2 > by1
end
This is only example, values can be not correct.
collision and table example:
Code: Select all
tileW, tileH = 32,32
-- player.x - player position at X
-- player.y - player position at Y
-- player.speed_y - player speed at Y axis
-- player.speed_x - player speed at X axis
for y = 1, #map do
local xy = map[y]
for x = 1, #xy do
local number = xy[x]
if player.y+32 >= ((y-1)*tileH) and player.y <= ((y-1)*tileH) and player.x > ((x-1)*tileW)-32 and player.x < ((x-1)*tileW)+32 then
player.speed_y = math.min(player.speed_y, 0)
elseif player.y >= ((y-1)*tileH) and player.y-32 <= ((y-1)*tileH) and player.x > ((x-1)*tileW)-32 and player.x < ((x-1)*tileW)+32 then
player.speed_y = math.max(player.speed_y, 0)
end
if player.y >= ((y-1)*32)-32 and player.y <= ((y-1)*tileH)+30 and player.x+32 > ((x-1)*tileW) and player.x < ((x-1)*tileW) then
player.speed_x = math.min(player.speed_x, 0)
elseif player.y >= ((y-1)*tileH)-32 and player.y <= ((y-1)*tileH)+32 and player.x > ((x-1)*tileW) and player.x-32 < ((x-1)*tileW) then
player.speed_x = math.max(player.speed_x, 0)
end
end
end
Who is online
Users browsing this forum: Semrush [Bot] and 1 guest