I have created a module called mask that checks if there is a colision inside a circle...
here it is:
But whenever I call it it does shit, nothin happens... Basicly what I want is that it checks if the is one impassable pixel inside the circle with 2*r diameter... Could you please tell me what's wrong?
here it is:
Code:
module Mask
def self.circle(x,y,r)
bottom_x = x
bottom_y = y
top_x = x
top_y = y
loop do
for i in -r...r
# check the bottom half circle
if self.passable?(bottom_x+i,bottom_y)
bottom_y - 1
r - 1
if top_y < y + r
@bottom = true
end
else
@bottom = false
end
# check the top half circle
if self.passable?(top_x+i,top_y)
top_y + 1
r - 1
if top_y > y+r
@top = true
end
else
@top = false
end
if @bottom = true and @top == true
return true
else return false
end
end
end
end
def self.passable?(x,y)
if $game_map.pixel_passable?(x,y,0, nil,"Tileset")
return true
else
return false
end
end
end
But whenever I call it it does shit, nothin happens... Basicly what I want is that it checks if the is one impassable pixel inside the circle with 2*r diameter... Could you please tell me what's wrong?