Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buncho Demo fixes I forgot to merge/push #357

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions Effects/Filters/source/filters/Grain.hx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ class Grain extends FlxShader
float width = openfl_TextureSize.x;
float height = openfl_TextureSize.y;

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

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

vec3 col = texture2D(bitmap, openfl_TextureCoordv).rgb;

//noisiness response curve based on scene luminance
vec3 lumcoeff = vec3(0.299,0.587,0.114);
float luminance = mix(0.0,dot(col, lumcoeff),lumamount);
float lum = smoothstep(0.2,0.0,luminance);
lum += luminance;


noise = mix(noise,vec3(0.0),pow(lum,4.0));
col = col+noise*grainamount;

gl_FragColor = vec4(col,1.0);
Expand Down
2 changes: 1 addition & 1 deletion Features/CollisionAndGrouping/Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- ____________________________ Window Settings ___________________________ -->

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

<!--HTML5-specific-->
<window if="html5" resizable="true" />
Expand Down
Binary file added Features/FlxFSM/assets/groundpound.ogg
Binary file not shown.
Binary file added Features/FlxFSM/assets/groundpoundfinish.ogg
Binary file not shown.
Binary file added Features/FlxFSM/assets/happynewyear.ogg
Binary file not shown.
Binary file added Features/FlxFSM/assets/jump.ogg
Binary file not shown.
Binary file added Features/FlxFSM/assets/powerup.ogg
Binary file not shown.
Binary file added Features/FlxFSM/assets/superjump.ogg
Binary file not shown.
Binary file added Features/FlxFSM/assets/walk.ogg
Binary file not shown.
8 changes: 8 additions & 0 deletions Features/FlxFSM/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ class PlayState extends FlxState
bgColor = 0xff661166;
super.create();

// Music by 8-BITek
// Licensed under CC BY-NC-ND 3.0
// https://www.newgrounds.com/audio/listen/1341678
FlxG.sound.playMusic("assets/happynewyear.ogg", 0);
FlxG.sound.music.fadeIn(2, 0, 0.2);

final J = 99;
final G = 100;
final columns = 20;
Expand Down Expand Up @@ -86,12 +92,14 @@ class PlayState extends FlxState

FlxG.overlap(_slime, _superJump, function (_, _)
{
FlxG.sound.play("assets/powerup.ogg");
_slime.addSuperJump();
_superJump.kill();
});

FlxG.overlap(_slime, _groundPound, function (_, _)
{
FlxG.sound.play("assets/powerup.ogg");
_slime.addGroundPound();
_groundPound.kill();
startGroundPoundInfoTween();
Expand Down
14 changes: 14 additions & 0 deletions Features/FlxFSM/source/Slime.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package;

import flixel.sound.FlxSound;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.util.FlxFSM;
Expand Down Expand Up @@ -95,8 +96,11 @@ class Conditions

class Idle extends FlxFSMState<Slime>
{
var walkSnd:FlxSound;

override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
walkSnd = FlxG.sound.load("assets/walk.ogg", 0.4);
owner.animation.play("standing");
}

Expand All @@ -105,6 +109,7 @@ class Idle extends FlxFSMState<Slime>
owner.acceleration.x = 0;
if (FlxG.keys.pressed.LEFT || FlxG.keys.pressed.RIGHT)
{
walkSnd.play();
owner.facing = FlxG.keys.pressed.LEFT ? LEFT : RIGHT;
owner.animation.play("walking");
owner.acceleration.x = FlxG.keys.pressed.LEFT ? -300 : 300;
Expand All @@ -115,12 +120,18 @@ class Idle extends FlxFSMState<Slime>
owner.velocity.x *= 0.9;
}
}

override function exit(owner:Slime) {
walkSnd.stop();
super.exit(owner);
}
}

class Jump extends FlxFSMState<Slime>
{
override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/jump.ogg", FlxG.random.float(0.9, 1.0));
owner.animation.play("jumping");
owner.velocity.y = -200;
}
Expand All @@ -139,6 +150,7 @@ class SuperJump extends Jump
{
override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/superjump.ogg", FlxG.random.float(0.9, 1.0));
owner.animation.play("jumping");
owner.velocity.y = -300;
}
Expand All @@ -150,6 +162,7 @@ class GroundPound extends FlxFSMState<Slime>

override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/groundpound.ogg");
owner.animation.play("pound");
owner.velocity.x = 0;
owner.acceleration.x = 0;
Expand All @@ -174,6 +187,7 @@ class GroundPoundFinish extends FlxFSMState<Slime>
{
override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/groundpoundfinish.ogg");
owner.animation.play("landing");
FlxG.camera.shake(0.025, 0.25);
owner.velocity.x = 0;
Expand Down
3 changes: 3 additions & 0 deletions Performance/PixelPerfectCollision/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class PlayState extends FlxState
updateSpriteAngles();
updateSpriteScales();

FlxG.camera.update(FlxG.elapsed);


// add objects for more interstellar fun!
for (i in 1...NUM_ALIENS)
addAlien();
Expand Down
Loading