public override void initialize() { // required renderer stuff clearColor = Color.Black; var renderer = addRenderer(new DefaultRenderer()); // setup inputs inputs = new InputHandler[NezGame.maxPlayers]; for (int i = 0; i < NezGame.maxPlayers; i++) { inputs[i] = new InputHandler(i); } SetupTitle(); NezGame.TurnOffMusic(); NezGame.TurnOnMusic(NezGame.gameMusic); }
private void collect(Collider other, Collider local) { if (!collected) { //set all the things to make collected = true; player = other.entity; local.active = false; var pc = player.getComponent <PlayerController>(); pc.turnOff(); var gs = (GameScene)entity.scene; foreach (var en in gs.enemies) { if (en.scene != null) { en.destroy(); } } var car = gs.car; var cc = car.getComponent <CarController>(); cc.headingHome = true; var finalPos = entity.position - new Vector2(0, 32); NezGame.TurnOffMusic(); gs.goalReachedSound.Play(1.0f, 0f, 0f); entity .tweenPositionTo(entity.position - new Vector2(0f, 80f), 0.3f) .setEaseType(Nez.Tweens.EaseType.SineOut) .setNextTween(entity .tweenPositionTo(finalPos, 0.8f) .setEaseType(Nez.Tweens.EaseType.SineIn) .setCompletionHandler((a) => { doneAnimating = true; entity.rotation = 0f; //do whatever stuff we need to with player Core.schedule(1.2f, (t) => this.entity.enabled = false); gs.fanfareSound.Play(0.25f, 0f, 0f); Core.schedule(2.4f, (t) => { pc.calmDown(); }); })) .start(); } }
public void sighOver(Animations anim) { //add the sigh sprite var scene = (GameScene)entity.scene; scene.sighSound.Play(0.3f, -0.5f, 0f); var sigh = entity.scene.addEntity(new Sigh(scene.tiles)); sigh.position = entity.position; sprite.onAnimationCompletedEvent -= sighOver; Core.schedule(2f, (t) => { NezGame.TurnOffMusic(); NezGame.TurnOnMusic(NezGame.postGameMusic); headingHome = true; var e = new Arrow(scene.carSubtextures); e.position = entity.position + new Vector2(30f, -60f); entity.scene.addEntity(e); }); }
public BoidsScene(NezGame game) { ClearColor = Color.Black; }