Sprite Editor (?)

Blitz3D Forums/Blitz3D Beginners Area/Sprite Editor (?)

Zace(Posted 2003) [#1]
Hi there, although not new here, my coding is.
I have created a grid and now want to populate it with tiles or sprites or whatever.
First I want the background - each cell can have a different one, then I will want to create items to overlay, eg, castle, infanty, whatever.
So I know I will need 2 or 3 layers.
BUT... how do I go about making an editor to create the actual tile ?
How can I make the background see through so that I dont overwrite information ?

Oh, and my grid...its a hex grid.

Any pointers REALLY appreciated.
CJS


jhocking(Posted 2003) [#2]
Creating tiles is done in an image editor. The tiles are simply 2D images (or rather sections of a 2D image.) You can use one of the common image editors (Photoshop, Paintshop Pro, GIMP, etc.) or a more special purpose tool like Pro Motion.

Other than the actual tiles you will need a map editor. I couldn't tell from your message if you will need this too but if so check out Tile Studio or Mappy. Both are excellent 2D map editors and both have code for use in Blitz.


semar(Posted 2003) [#3]
Hum, I don't know if I have really got your question.

Anyway.

Basically, when you need to draw multiple layers of images, what is important is:
- the color used for transparency.
- the order of image drawing

Usually, the colour used for transparency is usually the black one; that means, if you have two images, one big which is a picture of a billiard table, and a smaller which represents a billiard ball, then if the billiard ball is an image that uses black as transparent color, you will see the billiard with a nice rounded ball on it using the commands:

drawimage billiard,0,0
drawimage ball,100,100


Otherwise, if the ball image uses another colour for transparency, you will see a (coloured) rectangle on the billiard board, with a ball inside it. Unless you change the ball's transparency color (known als as mask color) with the appropriate command (MaskImage).

In other words, the mask color is the key to 'see through' images. Assuming that the mask color is black, for example, then everything black in the image will not be displayed and will not overwrite other images already drawn.

Usually the mask color is black; but if your image has a different mask color, then you can change it with MaskImage command:
Global Castle = Loadimage("Castle.bmp")
MaskImage castle,0,255,0 ;masked to green, so each green pixel of the castle image will NOT be drawn and will NOT cover any other image eventually 'under' it.

So, if in your hex grid you want to display a background, and on the background a castle, and on the castle a knight, then assuming that you have the black color as a transparent color for the castle and the knight sprite, you just need to do, at each loop:

DrawBlock background,0,0 ;DrawBlock will cover all despite transparency colour, so no need of cls (see manual)
drawimage castle, 100,100
drawimage knight, 110,120

So, since the background is drawn first, the castle 2nd and the knight the last one, the effect will be a nice background with a castle, and a knight near it.

If you, instead, draws the knight first, then the castle as 2nd and then the background, you will see only this one.

Hope this has sense for you,
Sergio.


Bremer(Posted 2003) [#4]
Here is a link to a sprite editor I found at Blitzcoder.com:

http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=zoragh03092003132437&comments=no

I hope you can use it.


Zace(Posted 2003) [#5]
Thanks semar, that is exactly what i am doing. Problem is my grid is 10 x 20, and it now is SOOO slow, literaly pressing a key then redaw according to movement used, but the keys now are not responsive as it takes too long to draw...

Any ideas?


WolRon(Posted 2003) [#6]
Sounds like a problem with your code. Blitz should have absolutely no problem redrawing 200 tiles every frame. I have a game that is redrawing 800-1000 every frame at 60 fps. Print a snippet of your drawing routine.


Zace(Posted 2003) [#7]
weird - works FINE on my slow laptop, but on my fast main PC it is like a 3 legged dog.


Bremer(Posted 2003) [#8]
Couldn't it be a problem with the drivers for the GFX card? I had that problem on one of my computers with a Nvidia card in it.