Author Topic: Custom Corona Tile  (Read 463 times)

2025-01-15, 14:15:12

Tanner

  • Active Users
  • **
  • Posts: 70
    • View Profile
Hello,

Quick Summary: Need help creating a two-row tile pattern where one row is offset. The two rows work separately but adding them together pattern breaks the intended layout. Is this possible with Corona Tile Map's custom mode?

---

I'm trying to create a custom tile pattern using Corona Tile Map's custom mode but running into some challenges with the pattern definition.

Pattern Description:
- Base tile size: 0.6m x 0.6m
- Pattern uses variations: 0.3x0.3m, 0.15x0.3m, 0.3x0.6m, 0.15x0.6m, 0.6x0.6m
I have posted an example from a recreation in Excel, showing the single pattern and how it repeats. (Image 1)

The intended pattern alternates between two rows:
1. Offset row (offset by 0.5):
   - 0.3x0.3m, 0.6x0.3m, 0.3x0.3m, 0.15x0.3m (then repeats)
2. Non-offset row:
   - 0.15x0.6m, 0.3x0.6m, 0.6x0.6m, 0.3x0.6m (then repeats)

What Works:
The non-offset row pattern works correctly with:
Code: [Select]
0 .25 1 | 0 .5 1 | 0 1 1 | 0 .5 1
This creates the correct sequence of tall tiles: narrow (0.15x0.6m), medium (0.3x0.6m), square (0.6x0.6m), medium (0.3x0.6m).

The offset row pattern also works alone as:
Code: [Select]
.5 .5 .5 | .5 1 .5 | .5 .5 .5 | .5 .25 .5
This creates the sequence of shorter tiles: square (0.3x0.3m), wide (0.6x0.3m), square (0.3x0.3m), narrow (0.15x0.3m).

The Challenge:
When trying to add the offset row pattern on its own row:
+ Attachments and other options
Code: [Select]
.5 .5 .5 | .5 1 .5 | .5 .5 .5 | .5 .25 .5 | 0 .25 1 | 0 .5 1 | 0 1 1 | 0 .5 1
The Tile Map appears to interpret the second part as a continuation of the same row rather than starting a new row in the pattern.
When combined, you can see it combines everything into one large row and repeats that pattern, rather than creating the intended alternating row pattern. (Image 2)

Question:
Is there a way to properly define this alternating row pattern in Corona Tile Map's custom mode? Or is this a limitation of how the custom pattern syntax works?
While this might be a limitation of the custom mode syntax, I feel like what I want might be possible using nested TileMaps or by generating both patterns separately and combining them with a simple mask differentiating rows (set to 1.2x1.2m) Edit: This will not work as it requires that one row to be 0.3m tall plus gap.

Thank you.
« Last Edit: 2025-01-15, 15:52:42 by Tanner »

2025-01-15, 15:40:00
Reply #1

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 9245
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Not sure if i understand what you're trying to achieve, but i you only need 2 rows, then you only have to add 1 row separator. I think this sequence does what you need:
Code: [Select]
0 .5 2 4 2 1 | -1 1 1 2 4 2
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2025-01-15, 16:18:43
Reply #2

Tanner

  • Active Users
  • **
  • Posts: 70
    • View Profile
Hi Romulus. I'm not sure what scale you're using with your pattern but is it safe to assume its 0.15m instead of 0.6m? And then each whole number in your pattern is multiplication scales of that base value? 

Also, how did you know about the row separator (I couldn't find anything in the doc about that)?

I did include an example of the intended pattern in my original post if you're trying to see what I'm aiming for.  The values you provided and adjusting my base tile size to 0.15x0.15 yielded this result, which may be close.  I think I need to adjust the pattern further though.


If it helps, this is the pattern, written out (WxH):

Row 1: [0.3x0.3] [0.6x0.3] [0.3x0.3] [0.15x0.3] (this row is offset by half)
---------------------------------------------------------------------------
Row 2: [0.15x0.6] [0.3x0.6] [0.6x0.6] [0.3x0.6]

Edit:

I think I figured it out, based on what you shared.  Setting tile width and height to 0.6, this is the pattern I used:
Code: [Select]
.25 .5 .5 1 .5 .25 | 0 1 .25 .5 1 .5
Attached is the result. On the left is raw from VFB; on the right is what it will end up looking like once I figure out the masks.
« Last Edit: 2025-01-15, 17:18:12 by Tanner »