public override void Init() { Tag = "Player"; Depth = 0; PlayerStand = new EksedraSprite(RunningEngine.Images["link-minish"], new IntRect[] { new IntRect(0, 404, 120, 116) }); PlayerFall = new EksedraSprite(RunningEngine.Images["link-minish"], new IntRect[] { new IntRect(120 * 7, 924, 120, 116) }); PlayerRun = new EksedraSprite(RunningEngine.Images["link-minish"], new IntRect[] { new IntRect(0, 924, 120, 116), new IntRect(120, 924, 120, 116), new IntRect(120 * 2, 924, 120, 116), new IntRect(120 * 3, 924, 120, 116), new IntRect(120 * 4, 924, 120, 116), new IntRect(120 * 5, 924, 120, 116), new IntRect(120 * 6, 924, 120, 116), new IntRect(120 * 7, 924, 120, 116), new IntRect(120 * 8, 924, 120, 116), new IntRect(120 * 9, 924, 120, 116), }); ImageScaleX = 0.5333f; ImageScaleY = 0.5333f; SpriteIndex = PlayerStand; ImageSpeed = 10; MaskX = -8; MaskY = -30; MaskWidth = 16; MaskHeight = 60; }
public override void Init() { Tag = "Boundary"; switch (BlockRotation) { case BlockType.Left: SpriteIndex = new EksedraSprite(RunningEngine.Images["boundary-block"], new IntRect[] { new IntRect(128, 0, 128, 64) }); break; case BlockType.Right: SpriteIndex = new EksedraSprite(RunningEngine.Images["boundary-block"], new IntRect[] { new IntRect(128, 64, 128, 64) }); break; case BlockType.Top: SpriteIndex = new EksedraSprite(RunningEngine.Images["boundary-block"], new IntRect[] { new IntRect(0, 0, 64, 128) }); break; case BlockType.Bottom: SpriteIndex = new EksedraSprite(RunningEngine.Images["boundary-block"], new IntRect[] { new IntRect(64, 0, 64, 128) }); break; default: SpriteIndex = null; break; } Cull = false; if (SpriteIndex != null) { SpriteIndex.Smooth = false; } }
static void Main() { #if _WINDOWS #else // Required for threads on linux to work // Must be called before anything else not just before window unfotunately. // Thus can't be part of lib XInitThreads(); #endif Console.WriteLine("Program started!"); EksedraSprite loadSprite = new EksedraSprite(new Texture("images/blueokirislogo-2018.png"), new IntRect[] { new IntRect(0, 0, 800, 600) }); Engine engine = new Engine( 1280, 720, "New Super Chunks", "title", new List <Type>() { typeof(ControlObject), typeof(Player), typeof(AirBlock), typeof(CloudThrough), typeof(GrassThrough), typeof(BlockType), typeof(BoundaryBlock), typeof(LadderBlock), typeof(WaterPlatform), typeof(Water), }, "NewSuperChunks", loadSprite); Console.WriteLine("Running engine!"); engine.Run(); }
public override void Draw(RenderTarget target, RenderStates states) { target.Draw(SpriteIndex); /*RectangleShape mask = new RectangleShape(); * mask.FillColor = Color.Black; * mask.Position = new Vector2f(X + MaskX, Y + MaskY); * mask.Size = new Vector2f(MaskWidth, MaskHeight); * target.Draw(mask);*/ if (Punched) { EksedraSprite animeLines = new EksedraSprite(RunningEngine.Images["anime-lines"], new IntRect[] { new IntRect(0, 0, 1280 * 3 / 4, 720 * 3 / 4) }); animeLines.MoveTo( RunningEngine.ViewPort.Left + RunningEngine.ViewPort.Width / 2, RunningEngine.ViewPort.Top + RunningEngine.ViewPort.Height / 2); animeLines.Smooth = true; target.Draw(animeLines); } if (Timers[1] != -1) { Splash.MoveTo(X, Y); Splash.ImageIndex += (1.0f / 30.0f) * Splash.ImageSpeed; target.Draw(Splash); } }
static void Main(string[] args) { #if _WINDOWS #else // Required for threads on linux to work // Must be called before anything else not just before window unfotunately. // Thus can't be part of lib XInitThreads(); #endif Console.WriteLine("Program started!"); EksedraSprite loadingSprite = new EksedraSprite(new Texture("images/face.png"), new IntRect[] { new IntRect(0, 0, 64, 64) }); Engine engine = new Engine( 1280, 720, "Eksedra Engine", "test", new List <Type>() { typeof(ControlObject), typeof(Player), typeof(Rock), typeof(JumpThrough) }, "test", loadingSprite); Console.WriteLine("Running engine!"); engine.Run(); }
public override void Init() { Tag = "Water"; Depth = 2; MaskX = -30; MaskY = -30; MaskWidth = 60; MaskHeight = 60; SpriteIndex = new EksedraSprite(RunningEngine.Images["water"], new IntRect[] { new IntRect(0, 0, 64, 64) }); SpriteIndex.Smooth = false; }
public override void Init() { Tag = "Ladder"; Depth = 1; SpriteIndex = new EksedraSprite(RunningEngine.Images["ladder"], new IntRect[] { new IntRect(0, 0, 64, 64) }); SpriteIndex.Smooth = false; MaskX = -20; MaskY = -32; MaskWidth = 52; MaskHeight = 64; }
public override void OnCollision(GameObject other) { if (other.Tag == "Player" && (other as Player).Punched && BlockPosition != BlockType.PassThrough && (other.Y + other.MaskY + other.MaskHeight > Y + MaskY && other.Y + other.MaskY < Y + MaskY + MaskHeight)) { BlockPosition = BlockType.PassThrough; SpriteIndex = new EksedraSprite(RunningEngine.Images["box"], new IntRect[] { new IntRect(64, 0, 64, 64) }); SpriteIndex.Smooth = false; (other as Player).Punched = false; other.VSpeed = -300; } }
public override void Init() { Tag = "Rock"; Depth = 1; SpriteIndex = new EksedraSprite(RunningEngine.Images["rock"], new IntRect[] { new IntRect(0, 0, 64, 64) }); ImageSpeed = 0; ImageIndex = 0; MaskX = -SpriteIndex.GetWidth() / 2; MaskY = -SpriteIndex.GetHeight() / 2; MaskWidth = SpriteIndex.GetWidth(); MaskHeight = SpriteIndex.GetHeight(); }
public override void Init() { Tag = "WaterPlatform"; Depth = 1; SpriteIndex = new EksedraSprite(RunningEngine.Images["water-platform"], new IntRect[] { new IntRect(0, 0, 64, 64) }); SpriteIndex.Smooth = false; ImageSpeed = 0; ImageIndex = 0; MaskX = -32; MaskY = -32; MaskWidth = 64; MaskHeight = 9; }
public override void Init() { Tag = "CloudThrough"; Depth = 1; SpriteIndex = new EksedraSprite(RunningEngine.Images["cloud_jumpthrough"], new IntRect[] { new IntRect(0, 0, 64, 64) }); SpriteIndex.Smooth = false; ImageSpeed = 0; ImageIndex = 0; MaskX = -32; MaskY = -32; MaskWidth = 64; MaskHeight = 9; }
public override void Init() { Tag = "Control"; RunningEngine.ViewPort.Width = 3 * 1280 / 4; RunningEngine.ViewPort.Height = 3 * 720 / 4; PlayButtonOff = new EksedraSprite(RunningEngine.Images["play_button"], new IntRect[] { new IntRect(0, 0, 512, 128) }); PlayButtonOn = new EksedraSprite(RunningEngine.Images["play_button"], new IntRect[] { new IntRect(0, 128, 512, 128) }); PlayButtonOff.MoveTo(1280 / 2, 720 / 2 + 64); PlayButtonOff.Smooth = true; PlayButtonOff.SetScale(0.5f, 0.5f); PlayButtonOn.MoveTo(1280 / 2, 720 / 2 + 64); PlayButtonOn.Smooth = true; PlayButtonOn.SetScale(0.5f, 0.5f); }
public override void Update(float deltaTime) { GameObject player = null; if (RunningEngine.CheckCollision(X, Y - 1, this, typeof(Player), (self, otra) => true, ref player)) { if ((player as Player).Pounded && BlockPosition != BlockType.PassThrough) { BlockPosition = BlockType.PassThrough; SpriteIndex = new EksedraSprite(RunningEngine.Images["box"], new IntRect[] { new IntRect(128, 0, 64, 64) }); SpriteIndex.Smooth = false; (player as Player).Pounded = false; player.VSpeed = -300; } } }
public override void Init() { Tag = "GrassBlock"; Depth = 1; ImageSpeed = 0; ImageIndex = 0; MaskX = -32; MaskY = -32; MaskWidth = 64; MaskHeight = 64; switch (BlockPosition) { case BlockType.Single: case BlockType.TopLeft: case BlockType.TopRight: case BlockType.Top: case BlockType.Right: SpriteIndex = new EksedraSprite(RunningEngine.Images["grass_blocks"], new IntRect[] { new IntRect(((int)BlockPosition) * 64, 0, 64, 64) }); break; case BlockType.Middle: case BlockType.BottomLeft: case BlockType.BottomRight: case BlockType.Left: case BlockType.Bottom: SpriteIndex = new EksedraSprite(RunningEngine.Images["grass_blocks"], new IntRect[] { new IntRect((((int)BlockPosition) - 5) * 64, 64, 64, 64) }); break; default: SpriteIndex = null; break; } if (SpriteIndex != null) { SpriteIndex.Smooth = false; } }
public override void Init() { Tag = "Player"; Depth = 0; PlayerStand = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(4, 4, 64, 64) }); PlayerStand.Smooth = false; PlayerJump = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(76, 4, 64, 64) }); PlayerJump.Smooth = false; PlayerFall = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(148, 4, 64, 64) }); PlayerFall.Smooth = false; PlayerRun = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(220, 4, 64, 64), new IntRect(292, 4, 64, 64), new IntRect(364, 4, 64, 64), new IntRect(436, 4, 64, 64), }); PlayerRun.Smooth = false; PlayerSuperJump = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(652, 4, 64, 64) }); PlayerSuperJump.Smooth = false; PlayerPunch = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(508, 4, 64, 64) }); PlayerPunch.Smooth = false; PlayerPunchDone = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(508, 76, 64, 64) }); PlayerPunchDone.Smooth = false; PlayerClimb = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(724, 4, 64, 64), new IntRect(724, 76, 64, 64), }); PlayerClimb.Smooth = false; PlayerSwim = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(4, 76, 64, 64), new IntRect(76, 76, 64, 64), new IntRect(148, 76, 64, 64), new IntRect(220, 76, 64, 64), }); PlayerSwim.Smooth = false; PlayerPound = new EksedraSprite(RunningEngine.Images["spr_chunks"], new IntRect[] { new IntRect(580, 76, 64, 64) }); PlayerPound.Smooth = false; Splash = new EksedraSprite(RunningEngine.Images["splash"], new IntRect[] { new IntRect(0, 0, 64, 64), new IntRect(64, 0, 64, 64), new IntRect(2 * 64, 0, 64, 64), new IntRect(3 * 64, 0, 64, 64), new IntRect(4 * 64, 0, 64, 64), new IntRect(5 * 64, 0, 64, 64), new IntRect(6 * 64, 0, 64, 64), new IntRect(7 * 64, 0, 64, 64), new IntRect(7 * 64, 0, 64, 64), new IntRect(7 * 64, 0, 64, 64), new IntRect(7 * 64, 0, 64, 64), new IntRect(7 * 64, 0, 64, 64), new IntRect(7 * 64, 0, 64, 64), }); Splash.SetScale(2, 2); Splash.ImageSpeed = 20; Splash.Smooth = false; SpriteIndex = PlayerStand; ImageSpeed = 10; MaskX = -20; MaskY = -32; MaskWidth = 40; MaskHeight = 52; // All false when game is done DoubleJumpUnlocked = true; PunchUnlocked = true; PoundUnlocked = true; }