private RenderComponent GetJetLongAnim(Distance offset) { return(new RenderComponent(MainAtlas.GetFrames("jetlong{0}.png"), 0.1) { Offset = offset }); }
private RenderComponent GetBurnerAnim(Distance offset) { return(new RenderComponent(MainAtlas.GetFrames("burner{0}.png"), 0.1) { Offset = offset + new Distance(-16, 0) }); }
private RenderComponent GetJetAnim(Distance offset, float rotation = 0) { return(new RenderComponent(MainAtlas.GetFrames("jet{0}.png"), 0.1) { Offset = offset, Rotation = rotation }); }
private Entity CreateLargeExplosion() { var result = new Entity() { Health = 1, Rectangle = new Rect(0, 0, 1, 1), IgnoreCollision = true }; result.AddComponent(new RenderComponent(MainAtlas.GetFrames("explosionlarge_{0}.png"), 0.1f)); result.AddComponent(new LifespanComponent(0.57f)); return(result); }
protected override void Start() { DefaultFont = AssetCache.LoadFont("DefaultFont.fnt"); MainAtlas = AssetCache.LoadAtlas("Atlas.json"); AssetCache.LoadTexture("Title.png"); Audio.PlayMusic(AssetCache.LoadMusic("song.mp3")); // Setup slices var beamTexture = MainAtlas.GetFrame("beam.png"); beamTexture.Slice = new SliceSettings() { Left = 2, Right = 2 }; var meterHolder = MainAtlas.GetFrame("meterholder.png"); meterHolder.Slice = new SliceSettings() { Left = 8, Right = 8 }; var meter = MainAtlas.GetFrame("meter.png"); meter.Slice = new SliceSettings() { Left = 2, Right = 2 }; Background.Add(new ParallaxLayer(MainAtlas.GetFrames("nebula{0}.png"), 50, (20, 45), (1f, 1f))); Background.Add(new ParallaxLayer(MainAtlas.GetFrames("star{0}.png"), 200, (100, 150), (1f, 1f))); // Load sounds AssetCache.LoadSound("hit0.wav"); AssetCache.LoadSound("hit1.wav"); AssetCache.LoadSound("hit2.wav"); AssetCache.LoadSound("explosion0.wav"); AssetCache.LoadSound("explosion1.wav"); AssetCache.LoadSound("explosion2.wav"); AssetCache.LoadSound("transform.wav"); AssetCache.LoadSound("shieldup.wav"); AssetCache.LoadSound("shielddown.wav"); Factory = new EntityFactory(AssetCache); Input.Register(Controls.Cancel, Keycode.Escape); Input.Register(Controls.Up, Keycode.W, Keycode.Up); Input.Register(Controls.Left, Keycode.A, Keycode.Left); Input.Register(Controls.Down, Keycode.S, Keycode.Down); Input.Register(Controls.Right, Keycode.D, Keycode.Right); Input.Register(Controls.Fire, MouseButton.Left, MouseButtonState.Pressed); Input.Register(Controls.Fire, Keycode.Space); Input.Register(Controls.TransformSmaller, Keycode.Q); Input.Register(Controls.TransformSmaller, MouseButton.X1, MouseButtonState.Released); Input.Register(Controls.TransformBigger, Keycode.E); Input.Register(Controls.TransformBigger, MouseButton.X2, MouseButtonState.Released); var action = Input.Register(Controls.DisableMusic, Keycode.M); action.OnReleased += OnDisableMusic; action = Input.Register(Controls.Debug, Keycode.F1); action.OnReleased += () => EnableDebug = !EnableDebug; State = new MenuState(Factory); }