How to make transparent a random area of a sprite before DrawSprite?

Previous topic - Next topic

Serge

Hi all,

I am trying to make transparent some random areas of a image before draw it to the back buffer. I saw the functions GetPixel and SetPixel but I think they work only over the back buffer.  I would need to be able to modify the image before draw it, so the areas that I randomly defined transparent will not be drawn.

Basically what I need is:

-Load an image in a sub-buffer where I could be able to read the pixels and modify them.
-Keep this image and the modifications in memory, since I would need to use it again.
-Redefine the DrawSprite, so I could be able to draw in the buffer only the areas that I required.

Is it possible?

Thanks so much and regards

Serge
www.tiptapgames.com

Kitty Hello

Not really.
You could try to access the sprite's pixel with CREATESCREEN and then USESCREEN to draw on the sprite.
What are you trying exactly?

Moru

You could also draw the sprite with polysprites, only the parts that you don't want transparent. I'm no expert on this command but I think it is possible :-)

Serge

Hi,

I need to have 2 images, one as backgrond and other one that at the begining does not have any transparency, so I will draw a irregular area on this image and I need to make transparent only this area, so it will be like a window where you can see the background.

I hope it clarifies.

Thanks again and best regards.

Serge
www.tiptapgames.com

Moru

Ok, if I understand you correctly I would only use one picture and draw the parts I want visible with POLYVECTOR.

POLYVECTOR has four coordinates for each point you draw, split the area in triangles, drawing each point beginning from the edges of the screen into the middle, first pair of coordinates are on the drawing surface, the second pair is from the source so you are mapping the image onto the screen. Hope you understand what I mean :-)

Kitty Hello

Yes, that or drawing the "holes" with drawrect.

There was some proof of concept for a lemmings / Worms IIRC...
(searches)

Hm. I can't find it anymore.

Ian Price

Here is a very limited "Lemmings" style deformable landscape. It draws a random landmass (that's larger than the visible screen) that can be destroyed by pressing the left mouse button. Scroll the landscape with LEFT and RIGHT cursors.

http://www.iprice.remakes.org/my_stuff/lemmings.rar

[edit, Kitty]
Added the file as an attachment, too (safety)
Search keywords:
Lemmings,lemmings,worms,Worms,holes,

[attachment deleted by admin]
I came. I saw. I played.

Serge

 =D That's exactly what I needed, thanks so much for your help!!

Serge
www.tiptapgames.com

Kitty Hello

did you try if that's fast enough on the iPhone? Would be interested...

Serge

Mhh, not yet, but I will make some performance test and let you know the results

Best regards

Serge
www.tiptapgames.com