private int modPlayerNormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, Player self) { int newState = orig(self); if (Settings.BounceEverywhere && newState == 0) { // we are still in the Normal state. // no bounce if the player is going to climb! Climbing should already take priority over bouncing. if (!SaveData.Instance.Assists.NoGrabbing && !self.Ducking && self.Stamina >= 20f && Input.GrabCheck && self.ClimbCheck((int)self.Facing)) { return(newState); } Level level = self.SceneAs <Level>(); Rectangle hitbox = self.Collider.Bounds; bool bounce = false; // check for collision below hitbox.Height++; if (level.CollideCheck <Solid>(hitbox) && self.Speed.Y >= 0f) { self.SuperBounce(self.Bottom); bounce = true; } else { // check for collision on the right hitbox.Height--; hitbox.Width++; if (level.CollideCheck <Solid>(hitbox) && self.SideBounce(-1, self.Right, self.CenterY)) { bounce = true; } else { // check for collision on the left hitbox.X--; if (level.CollideCheck <Solid>(hitbox) && self.SideBounce(1, self.Left, self.CenterY)) { bounce = true; } } } if (bounce) { Audio.Play("event:/game/general/spring", self.Center); } } return(newState); }
private int modPlayerNormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, Player self) { int newState = orig(self); if (Settings.BounceEverywhere && newState == 0) { // we are still in the Normal state. Level level = self.SceneAs <Level>(); Rectangle hitbox = self.Collider.Bounds; bool bounce = false; // check for collision below hitbox.Height++; if (level.CollideCheck <Solid>(hitbox) && self.Speed.Y >= 0f) { self.SuperBounce(self.Bottom); bounce = true; } else { // check for collision on the right hitbox.Height--; hitbox.Width++; if (level.CollideCheck <Solid>(hitbox) && self.SideBounce(-1, self.Right, self.CenterY)) { bounce = true; } else { // check for collision on the left hitbox.X--; if (level.CollideCheck <Solid>(hitbox) && self.SideBounce(1, self.Left, self.CenterY)) { bounce = true; } } } if (bounce) { Audio.Play("event:/game/general/spring", self.Center); } } return(newState); }
private static int onPlayerNormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, Player self) { int result = orig(self); // kill speed if player is going towards a jumpthru. if (self.Speed.X != 0) { bool movingLeftToRight = self.Speed.X > 0; SidewaysJumpThru jumpThru = self.CollideFirstOutside <SidewaysJumpThru>(self.Position + Vector2.UnitX * Math.Sign(self.Speed.X)); if (jumpThru != null && jumpThru.AllowLeftToRight != movingLeftToRight) { self.Speed.X = 0; } } return(result); }
private static int Player_NormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, Player self) { int newState = orig(self); if (newState == Player.StNormal) { // no bounce if the player is going to climb! Climbing should already take priority over bouncing. if (!SaveData.Instance.Assists.NoGrabbing && !self.Ducking && self.Stamina >= 20f && Input.GrabCheck && self.ClimbCheck((int)self.Facing)) { return(newState); } Level level = self.SceneAs <Level>(); Rectangle hitbox = self.Collider.Bounds; BouncyPanel bounce = null; // check for collision below hitbox.Y++; if (self.Speed.Y >= 0f) { foreach (BouncyPanel panel in level.CollideAll <BouncyPanel>(hitbox)) { if (panel.Orientation == Directions.Up) { self.SuperBounce(self.Bottom); bounce = panel; break; } } } if (bounce is null) { // check for collision on the right hitbox.Height--; hitbox.Width++; foreach (BouncyPanel panel in level.CollideAll <BouncyPanel>(hitbox)) { if (panel.Orientation == Directions.Left && self.SideBounce(-1, self.Right, self.CenterY)) { bounce = panel; break; } } } if (bounce is null) { // check for collision on the left hitbox.X--; foreach (BouncyPanel panel in level.CollideAll <BouncyPanel>(hitbox)) { if (panel.Orientation == Directions.Right && self.SideBounce(1, self.Left, self.CenterY)) { bounce = panel; break; } } } if (bounce is not null) { Audio.Play(bounce.sfx, self.Center); } } return(newState); }