summaryrefslogtreecommitdiffstats
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-02-19 11:57:14 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-02-19 11:57:14 -0300
commitd7d65fa2f2b51d03f7bdfcbceedca99188ce979c (patch)
treefecdf1bfa39ba5a4895b4dbf340a3b68098c109a /scene/2d/tile_map.cpp
parent8c1731b67995add31361ae526b0e6af76346181e (diff)
downloadredot-engine-d7d65fa2f2b51d03f7bdfcbceedca99188ce979c.tar.gz
-improved physics ccd
-html5 exporter works again -disable repeat on image loader by default -can change shape offset en tileset, texture offset was broken
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 26efa99a88..b9e44d5053 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -181,7 +181,7 @@ void TileMap::_update_dirty_quadrants() {
if (!tile_set->has_tile(c.id))
continue;
Ref<Texture> tex = tile_set->tile_get_texture(c.id);
- Vector2 tile_ofs = tile_set->tile_get_offset(c.id);
+ Vector2 tile_ofs = tile_set->tile_get_texture_offset(c.id);
Vector2 offset = Point2( E->key().x, E->key().y )*cell_size - q.pos;
@@ -215,6 +215,7 @@ void TileMap::_update_dirty_quadrants() {
rect.size.y=-rect.size.y;
+ rect.pos+=tile_ofs;
if (r==Rect2()) {
tex->draw_rect(q.canvas_item,rect);
@@ -231,8 +232,9 @@ void TileMap::_update_dirty_quadrants() {
Ref<Shape2D> shape = shapes[i];
if (shape.is_valid()) {
+ Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id);
Matrix32 xform;
- xform.set_origin(offset.floor());
+ xform.set_origin(offset.floor()+shape_ofs);
if (c.flip_h) {
xform.elements[0]=-xform.elements[0];
xform.elements[2].x+=s.x;
@@ -242,6 +244,7 @@ void TileMap::_update_dirty_quadrants() {
xform.elements[2].y+=s.y;
}
+
ps->body_add_shape(q.static_body,shape->get_rid(),xform);
}
}