Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (SBGuy, dr_panther, Ayumi, Quad, AndrewAMD), 920 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
fade screen effect slowdown #436796
02/02/14 16:52
02/02/14 16:52
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
in my game i have a red panel that covers the screen and gets visible and fades out when the player gets hurt, however it makes the fps drop significantly on some computers, so far only laptops, but they should be able to make such an effect without dropping in fps.

i just want to know if there is another way to make the screen fade in and out with a color or if that is the only solution, or if there is a way to optimise it.

Re: fade screen effect slowdown [Re: Denn15] #436798
02/02/14 17:11
02/02/14 17:11
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Are you using draw_quad to perfomt this action?
draw_quad is (like all other _draw functions) very computing heavy!

Re: fade screen effect slowdown [Re: Ch40zzC0d3r] #436799
02/02/14 17:18
02/02/14 17:18
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
Code:
function take_damage()
{
	wait(1);
	fadered.scale_x = screen_size.x;
	fadered.scale_y = screen_size.y;
	fadered.alpha = 30;
	effect_sprite("spark.tga", part6, 16, player_box.x, nullvector);
	while (fadered.alpha > 0)
	{
		fadered.alpha = fadered.alpha - 0.5 * 3 * time_step;
		wait (1);
	}
}



This is how i have made the fading effect. fadered is a panel consisting of a 64x64 red image.

Last edited by Denn15; 02/02/14 17:18.
Re: fade screen effect slowdown [Re: Denn15] #436803
02/02/14 18:01
02/02/14 18:01
Joined: Mar 2010
Posts: 57
Germany, Niedersachsen
LemmyTheSlayer Offline
Junior Member
LemmyTheSlayer  Offline
Junior Member

Joined: Mar 2010
Posts: 57
Germany, Niedersachsen
you might try to replace
Code:
fadered.scale_x = screen_size.x;
fadered.scale_y = screen_size.y;


with
Code:
fadered.scale_x = screen_size.x/64;
fadered.scale_y = screen_size.y/64;



scale_x and scale_y do not set the new panel size, they scale it.
that means, if your screen size is 1024x768, you would have a panel with a width of 1024*64=65536 pixels and a breadth of 768*64=49152 pixels.
that makes 65536*49125=3219456000 pixels in total. of course most of them won't be visible on the screen, but afaik the calculations are made anyway.


SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE SCHLEIFE
Re: fade screen effect slowdown [Re: LemmyTheSlayer] #436805
02/02/14 18:36
02/02/14 18:36
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You're confusing scale_x / y and size_x / y.


Always learn from history, to be sure you make the same mistakes again...
Re: fade screen effect slowdown [Re: Uhrwerk] #436806
02/02/14 19:17
02/02/14 19:17
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
doing like lemmytheslyaer suggested seems to work well. thanks for your help


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