realbasic-games
[Top] [All Lists]

Re: Spritesurface's Paint Tile method not working as advertised

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Spritesurface's Paint Tile method not working as advertised
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Mon, 13 Dec 2004 20:53:52 -0600
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <20041213180024 dot 113535CC549 at lists dot realsoftware dot com> <4D5899C3-4D69-11D9-B7A0-000A27E12C50 at pepelosoftware dot com>
At 7:44 PM -0500 12/13/04, Jose Lopez wrote:

Well, I have found the source of the problem. The thing is, the small overview map (which is a canvas named 'map') holds a picture which is a representation of the game world, with parts land and parts sea/water. In the PaintTile method I tried to directly read from that canvas map using the Pixel command, and according to the 'blue' value of the rgb color of that certain pixel draw a land or a water tile (at this moment, just a blunt green or blue box). This somehow upsets the garphics renderer and results in wired tile updates.

That's an interesting bug! But, in practical terms, calling map.Backdrop.Graphics.Pixel in your PaintTile event is not a good idea anyway. This is way slower than, well, virtually anything else I can think of. :)

Parse your map out into an array when you load the level, and whenever you need to know what's in a particular tile, look in the array.

I was hoping to use this simple shortcut for holding a map in a picture, since it would void the need to store a virtual digital map in memory (as in a two dimensional matrix or array) and spare the need to draw that map twice everytime, once to the main playing area (spritesurface) and another to the small overview map (canvas).

You need to do that anyway. Accessing pixels of a picture is a very laborious process, not something you'd want to do in a real-time game.

I was aditionally hoping to enable the player to create own custom maps using just a conventional drawing program, by simply drawing overview maps and then have the game transpose those directly into the main playing area on the fly.

You still have that. This is exactly how most of my old SpriteSurface demos work, including Platform Demo and RPG Demo.

Best,
- Joe

--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

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