World Limits problem
by Andy Hawkins · in Torque Game Builder · 08/25/2006 (5:57 pm) · 4 replies
I have a row of tiles for my background I am scrolling across the screen. They are 34 x 34 units in size (whatever the unit is in TGB). I have created a world limit to emcompass the row of tiles exactly. I have a callback that detects the world limit.
I have tried several things...
1. For the case "left" I set the position of the tile to the world limit to the right - result, no tile ever appears again.
2. I remove the case "right" (I think it cause the tile to flip back and forth) and the tiles start to appear but with random gaps.
3. I set the right position to be the tile width minus half the tile width and some gaps disappear but the tiles never line up.
I am moving the tiles at a value not divisible by their dimensions, of 100, maybe I should move them at 34 or 68 or something???
I would have thought this wrapping around is something TGB does automatically and it's possible my "tampering" is screwing it up. So what's the easiest way to scroll these tile around without gaps appearing and be able to scroll at any speed, not reliant on the dimensions of the tile?
I have tried several things...
1. For the case "left" I set the position of the tile to the world limit to the right - result, no tile ever appears again.
2. I remove the case "right" (I think it cause the tile to flip back and forth) and the tiles start to appear but with random gaps.
3. I set the right position to be the tile width minus half the tile width and some gaps disappear but the tiles never line up.
I am moving the tiles at a value not divisible by their dimensions, of 100, maybe I should move them at 34 or 68 or something???
I would have thought this wrapping around is something TGB does automatically and it's possible my "tampering" is screwing it up. So what's the easiest way to scroll these tile around without gaps appearing and be able to scroll at any speed, not reliant on the dimensions of the tile?
#2
The brown oblong box is the world limit I want my scroller to go to.
The small blue box is the tile/sprite I want to scroll.
The orangey red box is the screen extents.
How can I set up a scroller this way?
08/26/2006 (4:19 pm)
Okay I tried the scroller demo which seems to be what I want but for example when I make the tree size larger than the screen (to scroll outside the screen and back again) which is what I want to create my tiling scrollers, the tree is huge!!! I want to change the region the sprite scrolls in, but not the size of the tile / sprite itself. Here's a pic below...The brown oblong box is the world limit I want my scroller to go to.
The small blue box is the tile/sprite I want to scroll.
The orangey red box is the screen extents.
How can I set up a scroller this way?
#3
08/28/2006 (3:19 pm)
Have you tried creating a tilemap the size of the brown box and then just inserting your image where you have the blue box and leaving the rest of the tile slots blank? Then you should be able to use the wraping and autoPanning of the tile maps to scroll it.
#4
08/28/2006 (6:26 pm)
@Matthew - I'll give that a go. Currently I have used sprites, with world limits and the moment it hits the limit, I calculate how much it's gone over, then wrap it round minus the amount - this got rid of the gaps, but I think it's a brute force method and your idea may be more elegant.
Torque Owner Scott Jaworski