Skip to content

Commit 52889d6

Browse files
Buncho Demo fixes I forgot to merge/push (#357)
* fix grain shader * collision and grouping size fix * pixelperfect polish * added sounds+music to FlxFSM demo
1 parent 3e1fca1 commit 52889d6

12 files changed

Lines changed: 28 additions & 13 deletions

File tree

Effects/Filters/source/filters/Grain.hx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ class Grain extends FlxShader
3232
float width = openfl_TextureSize.x;
3333
float height = openfl_TextureSize.y;
3434

35-
const float grainamount = 0.05; //grain amount
35+
const float grainamount = 0.1; //grain amount
3636
bool colored = false; //colored noise?
3737
float coloramount = 0.6;
38-
float grainsize = 1.6; //grain particle size (1.5 - 2.5)
39-
float lumamount = 1.0; //
38+
float grainsize = 2.0; //grain particle size (1.5 - 2.5)
4039

4140
//a random texture generator, but you can also use a pre-computed perturbation texture
4241
vec4 rnm(in vec2 tc)
@@ -130,15 +129,6 @@ class Grain extends FlxShader
130129
}
131130

132131
vec3 col = texture2D(bitmap, openfl_TextureCoordv).rgb;
133-
134-
//noisiness response curve based on scene luminance
135-
vec3 lumcoeff = vec3(0.299,0.587,0.114);
136-
float luminance = mix(0.0,dot(col, lumcoeff),lumamount);
137-
float lum = smoothstep(0.2,0.0,luminance);
138-
lum += luminance;
139-
140-
141-
noise = mix(noise,vec3(0.0),pow(lum,4.0));
142132
col = col+noise*grainamount;
143133

144134
gl_FragColor = vec4(col,1.0);

Features/CollisionAndGrouping/Project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<!-- ____________________________ Window Settings ___________________________ -->
1717

1818
<!--These window settings apply to all targets-->
19-
<window width="400" height="300" fps="60" background="#000000" hardware="true" vsync="false" />
19+
<window width="800" height="600" fps="60" background="#000000" hardware="true" vsync="false" />
2020

2121
<!--HTML5-specific-->
2222
<window if="html5" resizable="true" />
11.6 KB
Binary file not shown.
9.86 KB
Binary file not shown.
1.85 MB
Binary file not shown.

Features/FlxFSM/assets/jump.ogg

25.6 KB
Binary file not shown.

Features/FlxFSM/assets/powerup.ogg

37.8 KB
Binary file not shown.
25.7 KB
Binary file not shown.

Features/FlxFSM/assets/walk.ogg

5.43 KB
Binary file not shown.

Features/FlxFSM/source/PlayState.hx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class PlayState extends FlxState
3030
bgColor = 0xff661166;
3131
super.create();
3232

33+
// Music by 8-BITek
34+
// Licensed under CC BY-NC-ND 3.0
35+
// https://www.newgrounds.com/audio/listen/1341678
36+
FlxG.sound.playMusic("assets/happynewyear.ogg", 0);
37+
FlxG.sound.music.fadeIn(2, 0, 0.2);
38+
3339
final J = 99;
3440
final G = 100;
3541
final columns = 20;
@@ -86,12 +92,14 @@ class PlayState extends FlxState
8692

8793
FlxG.overlap(_slime, _superJump, function (_, _)
8894
{
95+
FlxG.sound.play("assets/powerup.ogg");
8996
_slime.addSuperJump();
9097
_superJump.kill();
9198
});
9299

93100
FlxG.overlap(_slime, _groundPound, function (_, _)
94101
{
102+
FlxG.sound.play("assets/powerup.ogg");
95103
_slime.addGroundPound();
96104
_groundPound.kill();
97105
startGroundPoundInfoTween();

0 commit comments

Comments
 (0)