TileBlock and TileImage

Advanced game related topics
Krylar
User
User
Posts: 88
Joined: Thu Apr 15, 2004 3:17 pm

TileBlock and TileImage

Post by Krylar »

Hiya,

I know this isn't going to be super speedy or anything, but I've been going through stuff that I did in Blitz and working on making PB versions of them. This was in the process of doing a little starfield parallaxing thingy.

I'm finding a lot of things that PB has that Blitz doesnt, as well as finding things that Blitz has that PB doesn't.

Two functions that I used in Blitz are TileBlock and TileImage. They both take a sprite and cover the background with it, with TileBlock doing it destructively and TileImage using transparency. I don't know if PB has something that does this or not, but I couldn't find it so I coded up a quick one using PB procedures.

I've only set this up for use with a starfield and I haven't fully debugged it. Looks just fine with the starfield, but when I loaded up a different tileset the spacing acted a bit funny, so I'll dig into that later and figure it out.

Anyway, if you've any use for this, wanna make it better, faster, etc., feel free.

Code and assets: Click Here.

-Krylar
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Hope this helps :wink:

TileBlock = DisplaySprite
TileImage = DisplayTransparentSprite
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Nice code! I like the simple way of scrolling the tiles using a modulo, I never thought of that. :)
--Kale

Image
Krylar
User
User
Posts: 88
Joined: Thu Apr 15, 2004 3:17 pm

Post by Krylar »

TileBlock = DisplaySprite
TileImage = DisplayTransparentSprite
DisplaySprite and DisplayTransparentSprite seem to only display one at a time. There's an argument to have them display all over the background?

-Krylar
User avatar
Derlidio
User
User
Posts: 77
Joined: Fri Feb 27, 2004 9:19 pm
Location: SP - Brazil

Post by Derlidio »

You're right. PB doesn't support a statement to tile an image over a portion of the screen. At least, I didn't found it also. But as you have experienced in the sample code you wrote, it is fast enough to do it by other means :wink:

Regards...
Derlidio Siqueira
texxsound
User
User
Posts: 11
Joined: Sun Aug 29, 2004 12:04 pm
Location: Austria, EU

Post by texxsound »

I just skipped through the code but why didn't you use a Repeat-Until loop with FlipBuffers() and SetFramerate(100)? Wouldn't it be less lavishly ... :?:

Just a thought...
nevermind
Some do code in sweet delight, some do code in endless night
Krylar
User
User
Posts: 88
Joined: Thu Apr 15, 2004 3:17 pm

Post by Krylar »

texxsound wrote:I just skipped through the code but why didn't you use a Repeat-Until loop with FlipBuffers() and SetFramerate(100)? Wouldn't it be less lavishly ... :?:

Just a thought...
nevermind
Pretty much what I'm doing ;)
texxsound
User
User
Posts: 11
Joined: Sun Aug 29, 2004 12:04 pm
Location: Austria, EU

Post by texxsound »

Krylar wrote:
texxsound wrote:I just skipped through the code but why didn't you use a Repeat-Until loop with FlipBuffers() and SetFramerate(100)? Wouldn't it be less lavishly ... :?:

Just a thought...
nevermind
Pretty much what I'm doing ;)
so i just outed myself as a noob again.. lol
Some do code in sweet delight, some do code in endless night
Post Reply