summaryrefslogtreecommitdiff
path: root/scene/2d/area_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/area_2d.cpp')
-rw-r--r--scene/2d/area_2d.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 8bce489624..aca7a8c736 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -501,15 +501,15 @@ uint32_t Area2D::get_collision_mask() const {
return collision_mask;
}
-void Area2D::set_layer_mask(uint32_t p_mask) {
+void Area2D::set_collision_layer(uint32_t p_layer) {
- layer_mask = p_mask;
- Physics2DServer::get_singleton()->area_set_layer_mask(get_rid(), p_mask);
+ collision_layer = p_layer;
+ Physics2DServer::get_singleton()->area_set_collision_layer(get_rid(), p_layer);
}
-uint32_t Area2D::get_layer_mask() const {
+uint32_t Area2D::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void Area2D::set_collision_mask_bit(int p_bit, bool p_value) {
@@ -527,19 +527,19 @@ bool Area2D::get_collision_mask_bit(int p_bit) const {
return get_collision_mask() & (1 << p_bit);
}
-void Area2D::set_layer_mask_bit(int p_bit, bool p_value) {
+void Area2D::set_collision_layer_bit(int p_bit, bool p_value) {
- uint32_t mask = get_layer_mask();
+ uint32_t layer = get_collision_layer();
if (p_value)
- mask |= 1 << p_bit;
+ layer |= 1 << p_bit;
else
- mask &= ~(1 << p_bit);
- set_layer_mask(mask);
+ layer &= ~(1 << p_bit);
+ set_collision_layer(layer);
}
-bool Area2D::get_layer_mask_bit(int p_bit) const {
+bool Area2D::get_collision_layer_bit(int p_bit) const {
- return get_layer_mask() & (1 << p_bit);
+ return get_collision_layer() & (1 << p_bit);
}
void Area2D::_bind_methods() {
@@ -577,14 +577,14 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &Area2D::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &Area2D::get_collision_mask);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "layer_mask"), &Area2D::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &Area2D::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Area2D::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &Area2D::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &Area2D::set_collision_mask_bit);
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &Area2D::get_collision_mask_bit);
- ClassDB::bind_method(D_METHOD("set_layer_mask_bit", "bit", "value"), &Area2D::set_layer_mask_bit);
- ClassDB::bind_method(D_METHOD("get_layer_mask_bit", "bit"), &Area2D::get_layer_mask_bit);
+ ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &Area2D::set_collision_layer_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &Area2D::get_collision_layer_bit);
ClassDB::bind_method(D_METHOD("set_monitoring", "enable"), &Area2D::set_monitoring);
ClassDB::bind_method(D_METHOD("is_monitoring"), &Area2D::is_monitoring);
@@ -622,7 +622,7 @@ void Area2D::_bind_methods() {
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitoring"), "set_monitoring", "is_monitoring");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitorable"), "set_monitorable", "is_monitorable");
ADD_GROUP("Collision", "collision_");
- ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_layers", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_layer_mask", "get_layer_mask");
+ ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_mask", "get_collision_mask");
}
@@ -641,7 +641,7 @@ Area2D::Area2D()
monitoring = false;
monitorable = false;
collision_mask = 1;
- layer_mask = 1;
+ collision_layer = 1;
set_monitoring(true);
set_monitorable(true);
}