#58 ajout d'un item package servant à déployer des machines
This commit is contained in:
@@ -62,16 +62,16 @@ func impact_contamination(position : Vector2, impact_radius : int, to_value : fl
|
||||
Color(1., 1., 1., to_value)
|
||||
)
|
||||
|
||||
func get_contamination(point : Vector2) -> float:
|
||||
var pixel_point : Vector2 = (
|
||||
Vector2(point) / float(TERRAIN_IMAGE_GAME_FACTOR)
|
||||
- Vector2.ONE / 2
|
||||
)
|
||||
if (
|
||||
func is_in_image(pixel_point : Vector2, image : Image):
|
||||
return (
|
||||
pixel_point.x > 0
|
||||
and pixel_point.y > 0
|
||||
and pixel_point.x < contamination.get_width()
|
||||
and pixel_point.y < contamination.get_height()):
|
||||
and pixel_point.x < image.get_width()
|
||||
and pixel_point.y < image.get_height())
|
||||
|
||||
func get_contamination(point : Vector2) -> float:
|
||||
var pixel_point : Vector2 = get_pixel_point(point)
|
||||
if (is_in_image(pixel_point, contamination)):
|
||||
return contamination.get_pixel(
|
||||
int(round(pixel_point.x)),
|
||||
int(round(pixel_point.y))
|
||||
@@ -80,3 +80,9 @@ func get_contamination(point : Vector2) -> float:
|
||||
|
||||
func get_decontamination_coverage() -> float:
|
||||
return ImageTools.get_color_coverage(contamination)
|
||||
|
||||
func get_pixel_point(point : Vector2) -> Vector2:
|
||||
return (
|
||||
Vector2(point) / float(TERRAIN_IMAGE_GAME_FACTOR)
|
||||
- Vector2.ONE / 2
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user