+1 vote

Hi there,
I am currently trying to create a clone of the classic Donkey Kong arcade game. Unfortunately, I am struggling with the platform elements, when it comes to ascending sections. It seems like the original game took the same tile and just positioned it one pixel higher than the previous one.
My attempt was to use a TileMap with an 8x8 grid size. I hoped that there is a way to position tiles outside of the grid cell boundaries to achieve the same effect as described above, but I did not find any.
I am grateful for any suggestion on how to handle this. Maybe the attempt to solve this via a TileMap is not suitable?

in Engine

I solved this problem by not using TileMap for the platform elements but StaticBody2D.

by (20 points)
+1 vote

you can draw outside the edges
here is a function i use to draw an edge around the outside of a generated tilemap
first tile i place is at -1, -1

``````func _drawEdge() -> void:
var minY := rect.position.y - 1
var maxY := rect.end.y
var minX := rect.position.x - 1
var maxX := rect.end.x
for y in range(minY, maxY + 1):
for x in range(minX, maxX + 1):
if x == minX or x == maxX or y == minY or y == maxY:
if x == minX and y == minY: # nw
_edge.set_cell(x, y, Tile.EdgeOutsideCorner, false, false, false, Vector2(1, 0))
elif x == minX and y == maxY: # sw
_edge.set_cell(x, y, Tile.EdgeOutsideCorner, false, false, false, Vector2(2, 0))
elif x == maxX and y == minY: # ne
_edge.set_cell(x, y, Tile.EdgeOutsideCorner, false, false, false, Vector2(0, 0))
elif x == maxX and y == maxY: # se
_edge.set_cell(x, y, Tile.EdgeOutsideCorner, false, false, false, Vector2(3, 0))
elif x == minX: # w
_setRandomTile(_edge, x, y, Tile.EdgeOutside, false, Random.nextBool(), true)
elif x == maxX: # e
_setRandomTile(_edge, x, y, Tile.EdgeOutside, true, Random.nextBool(), true)
elif y == minY: # n
_setRandomTile(_edge, x, y, Tile.EdgeOutside, Random.nextBool(), false, false)
elif y == maxY: # s
_setRandomTile(_edge, x, y, Tile.EdgeOutside, Random.nextBool(), true, false)
elif (x == minX + 1) or (x == maxX - 1) or (y == minY + 1) or (y == maxY - 1):
if x == minX + 1 and y == minY + 1: # nw
_setRandomTile(_edge, x, y, Tile.EdgeInsideCorner, false, false, false)
elif x == minX + 1 and y == maxY - 1: # sw
_setRandomTile(_edge, x, y, Tile.EdgeInsideCorner, false, true, false)
elif x == maxX - 1 and y == minY + 1: # ne
_setRandomTile(_edge, x, y, Tile.EdgeInsideCorner, true, false, true)
elif x == maxX - 1 and y == maxY - 1: # se
_setRandomTile(_edge, x, y, Tile.EdgeInsideCorner, true, true, false)
elif x == minX + 1: # w
_setRandomTile(_edge, x, y, Tile.EdgeInside, false, Random.nextBool(), true)
elif x == maxX - 1: # e
_setRandomTile(_edge, x, y, Tile.EdgeInside, true, Random.nextBool(), true)
elif y == minY + 1: # n
_setRandomTile(_edge, x, y, Tile.EdgeInside, Random.nextBool(), false, false)
elif y == maxY - 1: # s
_setRandomTile(_edge, x, y, Tile.EdgeInside, Random.nextBool(), true, false)
``````
by (1,667 points)

Thanks for the support. May I ask where you add this function?

well, i call it immediately after generating a map...