realbasic-games
[Top] [All Lists]

Re: So then...... tiles and Sprite Surface

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: So then...... tiles and Sprite Surface
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Sun, 27 Jul 2003 12:23:57 -0700
At 12:25 PM -0500 7/27/03, Eric wrote:

So would I use xpos and ypos for look at data in a map?

Yes.

Ok I'm lost.... so draw at 0,0?

Yes.  How are you lost, exactly?

Tiles(game_Map_Layers(1).Get_Tile_ID(ypos+1,xpos+1)).Get_TileImage,?,?
What would do in the ?'s place?

You would use 0,0 (assuming that these are the parameters to a DrawPicture command).

 Do I use a loop or increment it some how?

Nope.

The map data is an array. So what ever is in say Map(0,1) the tile
that matches it needs to be drawn at the spot in Sprite Surface right?

Right, but when you're told (by the PaintTile event) to draw tile 0,1, then the graphics context (g) is already set up for you to draw it at 0,0.

So where do I get the  x,y from? - Assuming the tiles are 64 x 64.

Well, you could get them from the documentation, or by taking my word for it: x=0 and y=0.

Since I don't know much about SpriteSurface in's and out's would it not
be better for Spritesurface to draw at what ever the tiles size's are rather
than a set 64x64?

No, since you don't know much about SpriteSurface in's ound out's, it would be much better for you to stick with 64x64 tiles rather than attempt something more complex.

So if I use 32x32 I would need to draw 4 for ever I tile of Sprite Surface...ewe

Yes.

That sounds very hard....

Well, it won't seem so hard in another year or two, but yes, for now you should seize any opportunity to make it easier.

Well I check my cd no platform demo or any good examples or demos....

What? You should find quite a few. Search for "Platform" and "Blasteroids" and "RPG"... they'll all be there in a folder with my name on it. :) There are lots of other good examples too; poke around a bit.

You can also find some older versions of my code at <http://www.strout.net/info/coding/rb>. But I don't update that as often as we update the CD, so they might be a little dusty.

Going from Canvas to Sprite Surface is bit of a pain. Drawing
the tiles in Canvas is easy.

Overall the SpriteSurface is much (MUCH!) easier. You just need to quit thinking of it like a Canvas.

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'

---
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/>
.


<Prev in Thread] Current Thread [Next in Thread>