Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Konsti, AndrewAMD, 1 invisible), 1,376 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bmap_to_alpha and particles #177566
01/12/08 06:19
01/12/08 06:19
Joined: Dec 2006
Posts: 78
Nevada, USA
Futurulus Offline OP
Junior Member
Futurulus  Offline OP
Junior Member

Joined: Dec 2006
Posts: 78
Nevada, USA
Hi everyone,

I'm trying to make a laser effect for my game, and the manual says that bmap_to_alpha has replaced "flare", which I used extensively in A6. Here is my Code:
BMAP* BeamBmap = "laserpart.pcx";

function BeamPart(PARTICLE* this)
{
this.bmap = BeamBmap;
this.size = 2;
this.flags |= BEAM | TRANSLUCENT;
this.lifespan = .001; // lasts one frame: a new beam is created each frame
this.event = NULL;
}

function InitFX()
{
bmap_to_alpha(BeamBmap, 100);
return 1;
}


The results, however, aren't what I expected. The way it is, with the percent factor set at 100, the beam disappears:

Same for 30% (which the manual recommended) and 0%.

With the factor set to -100, the particles are opaque, black squares:

But without the bmap_to alpha, the particles have ugly black halos:


What am I doing wrong? I don't think this is a bug in Gamestudio; this project has had many problems, and all but one have been my fault. It's usually something simple, too. Can other pairs of eyes catch what mine have missed?

Sorry if the pictures don't show up; Google's been having issues lately...

Re: bmap_to_alpha and particles [Re: Futurulus] #177567
01/13/08 14:57
01/13/08 14:57
Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Frederick_Lim Offline
User
Frederick_Lim  Offline
User

Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Same here, the result of bmap_to_alpha() is not looks like "flare" flag in C-script.

Re: bmap_to_alpha and particles [Re: Frederick_Lim] #177568
01/18/08 22:59
01/18/08 22:59
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
then just open gimp. copy the image, put it into the alphachanel as greyscale image and save the whole stuff as *.tga

Re: bmap_to_alpha and particles [Re: Scorpion] #177569
01/18/08 23:13
01/18/08 23:13
Joined: Dec 2006
Posts: 78
Nevada, USA
Futurulus Offline OP
Junior Member
Futurulus  Offline OP
Junior Member

Joined: Dec 2006
Posts: 78
Nevada, USA
Yeah, I ended up doing that with Paint Shop Pro -- but the 60-day trial version doesn't last forever! It's easier in script, too. I'm not used to sophisticated image programs, layers and all that

Re: bmap_to_alpha and particles [Re: Futurulus] #177570
01/19/08 10:33
01/19/08 10:33
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
here I wrote a little function, that should do the job, too:

Code:
void create_flare(BMAP* picture)
{
VECTOR picture_size;
VECTOR paintPos;
int i;
int format;
float pixel;
picture_size.x = bmap_width(picture);
picture_size.y = bmap_height(picture);
format = bmap_lock(picture,0);
for(i=0;i<picture_size.x*picture_size.y;i++)
{
paintPos.x = i%picture_size.x;
paintPos.y = (picture_size.y-1)-integer(i/picture_size.x);
pixel=pixel_for_bmap(picture,paintPos.x,paintPos.y);
pixel_to_vec(temp,NULL,format,pixel);
pixel = pixel_for_vec(temp,(temp.x+temp.y+temp.z)/3/2.55,format);
pixel_to_bmap(picture,paintPos.x,paintPos.y,pixel);
}
bmap_unlock(picture);
}



Re: bmap_to_alpha and particles [Re: Scorpion] #177571
01/19/08 11:18
01/19/08 11:18
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
look at my old contribution... laser from .tga maybe will help
LINK


Never say never.
Re: bmap_to_alpha and particles [Re: tompo] #177572
01/19/08 21:18
01/19/08 21:18
Joined: Dec 2006
Posts: 78
Nevada, USA
Futurulus Offline OP
Junior Member
Futurulus  Offline OP
Junior Member

Joined: Dec 2006
Posts: 78
Nevada, USA
@Scorpion: I'm getting black boxes with your function, too. I see how it should work...what type of value does pixel_for_vec return? And if my image isn't already in an alpha format, does your function support it? If I make a PNG image with a few black pixels entirely transparent so I know it has an alpha channel, the particles disappear altogether.

@tompo: That is the kind of effect I'm looking for, but that's written in C-Script. Lite-C is the core of the problem: flare doesn't exist anymore, and the suggested replacement doesn't seem to do what it's supposed to.

EDIT: here is a link to my Gamestudio Picasa album, so you can see the pictures: http://picasaweb.google.com/Futurulus/Gamestudio

Last edited by Futurulus; 01/20/08 00:08.
Re: bmap_to_alpha and particles [Re: Futurulus] #177573
01/20/08 11:43
01/20/08 11:43
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
pixel_for_bmap gets the pixel-color/alpha of the bmap in a single float variable.
pixel_to_vec converts it to a color-vector, which is temp here.
pixel_for_vec again returns such a float variable
pixel_to_bmap writes it to the position again

the only thing i could think of, that you convert that bmap to another format(with alpha), but i don't know a function that does that. So try to save them already as 32-bit tgas. Then it should work.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1