please help me... i try but cant create good collision.
this is map from game, map is none object ( standard png image ) player hero image is png format 48x64. how create good collision for elements from image ?
this is map (1024x768)
and this is first plan to hide hero to back (1024x768)
Collision - bitmap background
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Collision - bitmap background
I think you need to place rectangle shapes on your level, that hero may collide with it.
Re: Collision - bitmap background
i try with rectangle and for me this is not what i need :/ the best way if can I use line collision.
i have problem with none horizontal and none vertical lines :/ like this on image.
i use to collision one center point from hero image.
i have problem with none horizontal and none vertical lines :/ like this on image.
i use to collision one center point from hero image.
Re: Collision - bitmap background
eureka... Collision - Point with any Line. For me this thopic is closed thx...
Code: Select all
function PointCollisionWithLine(x,y,x1,y1,x2,y2,tolerance)
-- range from x,y to x1,y1
a = x - x1
b = y - y1
c = (a*a) + (b*b)
c1 = math.sqrt(c)
-- range from x,y to x2,y2
a = x - x2
b = y - y2
c = (a*a) + (b*b)
c2 = math.sqrt(c)
-- range from x1,y1 to x2,y2
a = x1 - x2
b = y1 - y2
c = (a*a) + (b*b)
c3 = math.sqrt(c)
if (c1+c2)<=(c3+tolerance) then return true else return false end
end
Re: Collision - bitmap background
Woo! You're pretty smart.
Re: Collision - bitmap background
thx...
good think for this is the same function but short.
if collision lines is constant then we not must calculate line range any time, we can use function like this:
good think for this is the same function but short.
if collision lines is constant then we not must calculate line range any time, we can use function like this:
Code: Select all
function PointCollisionWithLine2(x,y,x1,y1,x2,y2,line_range_with_tolerance)
-- range from x,y to x1,y1
a = x - x1
b = y - y1
c1 = math.sqrt((a*a) + (b*b))
-- range from x,y to x2,y2
a = x - x2
b = y - y2
c2 = math.sqrt((a*a) + (b*b))
if (c1+c2)<=line_range_with_tolerance then return true else return false end
end
Who is online
Users browsing this forum: Bing [Bot], Google Adsense [Bot] and 4 guests