>
> Do this:
> 1) Create a SpriteSurface subclass if you haven't already. You really
> should that way you can reuse the code from project to project very
> easily.
>
> 2) Put this in the PaintTile event of the subclass after defining
> TileHeight and TileWidths as constants or properties.
>
> /////////////////////////////////////////
> // Contributed by Joe Strout //
> /////////////////////////////////////////
>
> Dim startcol, endcol, startrow, endrow As Integer
> Dim row, col As Integer
> Dim worldX, worldY As Integer
> Dim dx, dy As Integer
>
> if TileWidth > 0 and TileHeight > 0 then
> worldX = xpos * 64
> worldY = ypos * 64
> startcol = worldX / TileWidth
> startrow = worldY / TileHeight
> endcol = (worldX + 63) / TileWidth
> endrow = (worldY + 63) / TileHeight
>
> dy = startrow * TileHeight - worldY
> for row = startrow to endrow
> dx = startcol * TileWidth - worldX
> for col = startcol to endcol
> PaintTile g, dx, dy, row, col
> dx = dx + TileWidth
> next
> dy = dy + TileHeight
> next
>
> else
> PaintTile g, xpos, ypos, row, col
> end if
>
>
Well I tried this and it doesn't work.
I made the subclass put the code in made an
instance. Ok no prob.
Now when I went to put the following in
there was no place to put it. No paint tile
in the instance.
Does it matter what version of RB I'm using?
3) Then put this in the instance:
dim p as picture
p = SWWorld1.map.GetTile(row, column)
if p <> nil then
if xpos > 0 and ypos > 0 and xpos < me.SurfaceWidth and ypos <
me.SurfaceHeight then
g.drawpicture p, xpos, ypos
end if
end if
---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
.
|