public SetPosition ( Vector2 newPosition ) : void | ||
newPosition | Vector2 | |
return | void |
protected void Stop() { if (node != null) { Futile.instance.SignalUpdate -= HandleUpdate; node.SetPosition(oPosition); _pendings.Remove(node); node = null; } }
public void LoadNewMap(string mapName) { currentState = State.TRANS; C.getCameraInstance().setWorldBounds(new Rect(0, -loadMap.height, 0, 0)); FNode followNode = new FNode(); followNode.SetPosition(C.getCameraInstance().GetPosition()); C.getCameraInstance().follow(followNode); Vector2 dir = RXRandom.Vector2Normalized(); float dist = 600; followNode.alpha = 0; Go.to(followNode, .3f, new TweenConfig().floatProp("alpha", 1).onComplete(() => { FSoundManager.PlaySound("transition"); })); Go.to(followNode, 1.0f, new TweenConfig().floatProp("x", dir.x * dist, true).floatProp("y", dir.y * dist, true).setEaseType(EaseType.BackIn).onComplete(() => { LoadMap(mapName); followNode.x = p.x - dir.x * dist; followNode.y = p.y - dir.y * dist; C.getCameraInstance().x = p.x - dir.x * dist; C.getCameraInstance().y = p.y - dir.y * dist; if (!ui.isVisible) { ui.y = 50; ui.isVisible = true; Go.to(ui, 2.0f, new TweenConfig().floatProp("y", 0).setEaseType(EaseType.BackOut)); } Go.to(followNode, 1.0f, new TweenConfig().floatProp("x", p.x).floatProp("y", p.y).setEaseType(EaseType.BackOut).onComplete(() => { UpdateWorldBounds(); C.getCameraInstance().follow(p); p.CurrentState = Player.State.IDLE; inDeadMode = false; NextWave(); })); })); }
internal void loadMap(string mapName) { this.clearMap(); this.LoadTMX("Maps/" + mapName); tilemap = (FTilemap)(getLayerNamed("Tilemap")); for (int x = 0; x < 3; x++) { otherTilemaps[x] = new FTilemap(tilemap.BaseElementName + "_" + (x + 1), 1); otherTilemaps[x].LoadText(tilemap.dataString, false); } tilemapCollision = (FTilemap)(getLayerNamed("Meta")); objectGroup = (FContainer)(getLayerNamed("Objects")); foreach (XMLNode xml in this.objects) { switch (xml.attributes["type"]) { case "Spawn": FNode spawnPoint = new FNode(); spawnPoint.SetPosition(int.Parse(xml.attributes["x"]) + 8, -int.Parse(xml.attributes["y"]) + 8); spawnPoints.Add(spawnPoint); player.SetPosition(spawnPoint.GetPosition()); break; case "Warp": int warpX = 0; int warpY = 0; XMLNode propertiesNode = (XMLNode)xml.children[0]; foreach (XMLNode property in propertiesNode.children) { switch (property.attributes["name"]) { case "warpTileX": warpX = int.Parse(property.attributes["value"]); break; case "warpTileY": warpY = int.Parse(property.attributes["value"]); break; } } WarpPoint warpPoint = new WarpPoint(warpX, warpY, xml.attributes["name"], int.Parse(xml.attributes["x"]) + 8, -int.Parse(xml.attributes["y"]) + 8); warpPoints.Add(warpPoint); break; } } for (int x = 0; x < 100; x++) { Scientist s = new Scientist(tilemap.width * RXRandom.Float(), -tilemap.height * RXRandom.Float()); while (BaseGameObject.isWalkable(tilemap, s.x, s.y)) { s.SetPosition(tilemap.width * RXRandom.Float(), -tilemap.height * RXRandom.Float()); } addEnemy(s); } backgroundLayer.AddChild(tilemap); foreach (FTilemap f in otherTilemaps) { backgroundLayer.AddChild(f); } backgroundLayer.AddChild(tilemapCollision); backgroundLayer.AddChild(objectGroup); player.setMap(this); playerLayer.AddChild(player); }
public static void Cancel(FNode node) { OscilUtil instance=null; pendings.TryGetValue(node, out instance); if (instance!=null) { instance.chain.destroy(); node.SetPosition(instance.memoPos); pendings.Remove(node); } }
// Use this for initialization void Start() { FutileParams futileParams = new FutileParams(true, false, false, false); futileParams.AddResolutionLevel(640.0f / 4f, 1.0f, 1.0f, ""); futileParams.origin = new Vector2(0.5f, 0.5f); futileParams.backgroundColor = new Color(0 / 255.0f, 94 / 255.0f, 38 / 255.0f); futileParams.shouldLerpToNearestResolutionLevel = true; Futile.instance.Init(futileParams); // UnityEngine.Screen.SetResolution(640, 480, false); Futile.atlasManager.LoadAtlas("Atlases/inGameAtlas"); Futile.atlasManager.LoadFont(C.smallFontName, "smallFont_0", "Atlases/smallFont", 0, 0); Futile.atlasManager.LoadFont(C.largeFontName, "largeFont_0", "Atlases/largeFont", 0, 0); FSoundManager.PlayMusic("OGreatBG"); C.getCameraInstance().SetPosition(Futile.screen.halfWidth, -Futile.screen.halfHeight); FSprite bevelOverlay = new FSprite(Futile.whiteElement); bevelOverlay.width = Futile.screen.width; bevelOverlay.height = Futile.screen.height; bevelOverlay.shader = FShader.Basic_PixelSnap; bevelOverlay.sortZ = 100; w = new World(); Futile.stage.AddChild(w); twitter = new FLabel(C.smallFontName, "@MaggardJosh"); twitter.x = Futile.screen.halfWidth - twitter.textRect.width / 2f; twitter.y = -Futile.screen.halfHeight + twitter.textRect.height / 2f; C.getCameraInstance().AddChild(twitter); madeForLD = new FLabel(C.smallFontName, "Made in 48 hours\nfor Ludum Dare 33"); madeForLD.alignment = FLabelAlignment.Left; madeForLD.x = -Futile.screen.halfWidth; madeForLD.y = -Futile.screen.halfHeight + madeForLD.textRect.height / 2f; C.getCameraInstance().AddChild(madeForLD); w.LoadMap("titleMap"); w.currentState = World.State.IN_GAME; w.UpdateWorldBounds(); Futile.stage.AddChild(C.getCameraInstance()); C.getCameraInstance().SetPosition(w.p.GetPosition()); C.getCameraInstance().AddChild(bevelOverlay); w.p.CurrentState = Player.State.DYING; tempFollowNode = new FNode(); tempFollowNode.SetPosition(w.p.GetPosition()); C.getCameraInstance().follow(tempFollowNode); StartRandomMapMovement(); w.ui.isVisible = false; w.p.SetPosition(-1000, 1000); pressStart = new FLabel(C.smallFontName, "CLICK TO START"); C.getCameraInstance().AddChild(pressStart); pressStart.y = -Futile.screen.halfHeight * .3f; pressStart.alpha = 0; o = new FLabel(C.largeFontName, "O"); o.alignment = FLabelAlignment.Left; g = new FLabel(C.largeFontName, "G"); r = new FLabel(C.largeFontName, "R"); e = new FLabel(C.largeFontName, "E"); g.alignment = FLabelAlignment.Left; r.alignment = FLabelAlignment.Left; e.alignment = FLabelAlignment.Left; a = new FLabel(C.largeFontName, "A"); a.alignment = FLabelAlignment.Left; t = new FLabel(C.largeFontName, "T"); t.alignment = FLabelAlignment.Left; ogreatContainer = new FContainer(); ogreatContainer.AddChild(o); ogreatContainer.AddChild(g); ogreatContainer.AddChild(r); ogreatContainer.AddChild(e); ogreatContainer.AddChild(a); ogreatContainer.AddChild(a); ogreatContainer.AddChild(t); C.getCameraInstance().AddChild(ogreatContainer); e.x = -e.textRect.width / 2f; r.x = e.x - r.textRect.width; g.x = r.x - g.textRect.width; o.x = g.x - o.textRect.width - 10; a.x = e.x + e.textRect.width; t.x = a.x + a.textRect.width; ogreatContainer.y = Futile.screen.height * .3f; ogreatContainer.x = 10; float duration = 2.0f; float initDuration = .8f; Color greenColor = new Color(0, .3f, 0); o.y = g.y = r.y = e.y = a.y = t.y = Futile.screen.halfHeight; Go.to(o, initDuration, new TweenConfig().floatProp("y", 0).setDelay(.5f).setEaseType(EaseType.BackOut)); Go.to(g, initDuration, new TweenConfig().floatProp("y", 0).setDelay(.6f).setEaseType(EaseType.BackOut)); Go.to(r, initDuration, new TweenConfig().floatProp("y", 0).setDelay(.7f).setEaseType(EaseType.BackOut)); Go.to(e, initDuration, new TweenConfig().floatProp("y", 0).setDelay(.8f).setEaseType(EaseType.BackOut)); Go.to(a, initDuration, new TweenConfig().floatProp("y", 0).setDelay(.9f).setEaseType(EaseType.BackOut)); Go.to(t, initDuration, new TweenConfig().floatProp("y", 0).setDelay(1.0f).setEaseType(EaseType.BackOut).onComplete(() => { Go.to(o, duration, new TweenConfig().floatProp("x", 11, true).colorProp("color", greenColor).setEaseType(EaseType.CircInOut).setIterations(-1, LoopType.PingPong)); Go.to(g, duration, new TweenConfig().colorProp("color", greenColor).setEaseType(EaseType.CircInOut).setIterations(-1, LoopType.PingPong)); Go.to(r, duration, new TweenConfig().colorProp("color", greenColor).setEaseType(EaseType.CircInOut).setIterations(-1, LoopType.PingPong)); Go.to(e, duration, new TweenConfig().colorProp("color", greenColor).setEaseType(EaseType.CircInOut).setIterations(-1, LoopType.PingPong)); Futile.instance.SignalUpdate += OnUpdate; Go.to(pressStart, 1.0f, new TweenConfig().floatProp("alpha", 1.0f).setDelay(.5f).setEaseType(EaseType.QuadIn)); })); w.inDeadMode = true; ((FPixelSnapShader)FShader.Basic_PixelSnap).dotMatrixAmount = Futile.displayScaleInverse; }
public void OpenDoor(string doorName) { foreach (FutilePlatformerBaseObject o in collisionObjects) { if (!(o is Door)) continue; Door d = (Door)o; if (d.name.ToLower() == doorName.ToLower()) { C.isTransitioning = true; FNode tempFollowNode = new FNode(); tempFollowNode.SetPosition(player.GetPosition()); C.getCameraInstance().follow(tempFollowNode); Go.to(tempFollowNode, 2.0f, new TweenConfig().floatProp("x", d.x).floatProp("y", d.y).setEaseType(EaseType.QuadInOut).onComplete(() => { C.getCameraInstance().shake(.6f, .5f); d.Open(); Go.to(tempFollowNode, 1.5f, new TweenConfig().floatProp("x", player.x).floatProp("y", player.y).setEaseType(EaseType.QuadInOut).setDelay(1.3f).onComplete(() => { C.getCameraInstance().follow(player); C.isTransitioning = false; })); })); } } }