public override void Start() { root = FPWorld.Create(64.0f); screenCenter=new Vector2(Futile.screen.halfWidth,Futile.screen.halfHeight); ListenForUpdate(Update); _gameObjects = new FContainer(); AddChild(_gameObjects); _enemyContainer = new FContainer(); AddChild(_enemyContainer); AddChild(impactParticles = new FParticleSystem(40)); AddChild(projectilesParticles = new FParticleSystem(300)); _playerBullets = new FContainer(); AddChild(_playerBullets); t = Time.time; CreateWorld(); InitPlayer(); scoreLabel = new FLabel("font", "Score = "+ Score); gameOver = new FLabel("font", "Game Over, press 'R' to try again!"); scoreLabel.SetAnchor(new Vector2(0,-10)); AddChild(scoreLabel); FSoundManager.PlayMusic("Barymag"); FSoundManager.isMuted=false; }
override public void Start() { root = FPWorld.Create(64.0f); screenCenter = new Vector2(Futile.screen.halfWidth, Futile.screen.halfHeight); ListenForUpdate(Update); _gameObjects = new FContainer(); AddChild(_gameObjects); _enemyContainer = new FContainer(); AddChild(_enemyContainer); AddChild(impactParticles = new FParticleSystem(40)); AddChild(projectilesParticles = new FParticleSystem(300)); _playerBullets = new FContainer(); AddChild(_playerBullets); t = Time.time; CreateWorld(); InitPlayer(); scoreLabel = new FLabel("font", "Score = " + Score); gameOver = new FLabel("font", "Game Over, press 'R' to try again!"); scoreLabel.SetAnchor(new Vector2(0, -10)); AddChild(scoreLabel); FSoundManager.PlayMusic("Barymag"); FSoundManager.isMuted = false; }
override public void Start() { Futile.atlasManager.LoadImage("chopper"); Futile.atlasManager.LoadImage("man"); this.AddChild(persons = new FContainer()); ListenForUpdate(HandleUpdate); root = FPWorld.Create(64.0f); for (int i = 0; i < 50; i++) { Platform p = Platform.Create(); p.Init(new Vector2(i * 250, RXRandom.Range(-100, 100) * i), this); Person b = Person.Create(); b.Init(new Vector2(p.sprite.x, p.sprite.y + 532), this); b.GameOver = HandleGameOver; } c = Chopper.Create(); c.Init(new Vector2(0, 128), this); RXWatcher.Watch(this); Futile.stage.Follow(c.sprite, false, false); }
void Start() { Go.defaultEaseType = EaseType.SineInOut; FutileParams fp = new FutileParams(true, true, false, false); fp.AddResolutionLevel(480f, 1.0f, 1.0f, "-res1"); fp.AddResolutionLevel(1136f, 2.0f, 2.0f, "-res2"); fp.AddResolutionLevel(2048f, 4.0f, 4.0f, "-res4"); fp.backgroundColor = new Color(0.5f, 0.5f, 0.5f); fp.origin = Vector2.zero; Futile.instance.Init(fp); Futile.atlasManager.LoadAtlas("Atlases/MainSheet"); Futile.atlasManager.LoadFont("franchise", "franchise", "Atlases/franchise", -7, -16); // futile done initing WTUtils.Init(); handler = new WTHandler(); handler.SignalUpdate += HandleUpdate; handler.SignalLateUpdate += HandleLateUpdate; handler.SignalFixedUpdate += HandleFixedUpdate; handler.SignalMultiTouch += HandleMultiTouch; Futile.stage.AddChild(handler); FPWorld.Create(64.0f); currentScene = new WTMainScene(); Futile.stage.AddChild(currentScene); }
public static FPWorld Create(float metersToPointsRatio) { GameObject gameObject = new GameObject("FPWorld Root"); instance = gameObject.AddComponent <FPWorld>() as FPWorld; instance.Init(metersToPointsRatio); return(instance); }
public static FPWorld Create(float metersToPointsRatio) { GameObject gameObject = new GameObject("FPWorld Root"); instance = gameObject.AddComponent<FPWorld>() as FPWorld; instance.Init(metersToPointsRatio); return instance; }
// Use this for initialization void Start() { //instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; bool landscape = true; bool portrait = false; bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad && portrait; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown); fparams.backgroundColor = new Color(0.1f, 0.1f, 0.1f); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2"); //iPad fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.0f, 0.0f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/UIFonts"); Futile.atlasManager.LoadAtlas("Atlases/GameAtlas"); FPWorld.Create(64.0f); FTextParams textParams; textParams = new FTextParams(); textParams.lineHeightOffset = -8.0f; Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix, "Atlases/FranchiseFont" + Futile.resourceSuffix, -2.0f, -5.0f, textParams); textParams = new FTextParams(); textParams.kerningOffset = -0.5f; textParams.lineHeightOffset = -8.0f; Futile.atlasManager.LoadFont("CubanoInnerShadow", "Cubano_InnerShadow" + Futile.resourceSuffix, "Atlases/CubanoInnerShadow" + Futile.resourceSuffix, 0.0f, 2.0f, textParams); GoToPage(PageType.BitmaskPuzzleShapesGame); }
public World() { instance = this; isGameOver = false; root = FPWorld.Create(64.0f); AddChild(backParticles = new FParticleSystem(150)); AddChild(chainHolder = new FContainer()); AddChild(beastShadowHolder = new FContainer()); AddChild(beastHolder = new FContainer()); AddChild(effectHolder = new FContainer()); AddChild(glowParticles = new FParticleSystem(150)); glowParticles.shader = FShader.Additive; AddChild(orbHolder = new FContainer()); uiStage = new FStage("UIStage"); Futile.AddStage(uiStage); uiStage.scale = Futile.stage.scale; uiStage.AddChild(uiHolder = new FContainer()); teams = GameManager.instance.activeTeams; InitBeasts(); InitOrbs(); InitUI(); spawnRateMultiplier = 1.0f; walls = new Walls(this); ListenForUpdate(HandleUpdate); Input.ResetInputAxes(); }
void Start() { Go.defaultEaseType = EaseType.SineInOut; FutileParams fp = new FutileParams(true, true, false, false); fp.AddResolutionLevel(480f, 1.0f, 1.0f, "-res1"); fp.AddResolutionLevel(1136f, 2.0f, 2.0f, "-res2"); fp.AddResolutionLevel(2048f, 4.0f, 4.0f, "-res4"); fp.backgroundColor = Color.white; fp.origin = Vector2.zero; Futile.instance.Init(fp); Futile.atlasManager.LoadAtlas("Atlases/MainSheet"); Futile.atlasManager.LoadFont("franchise", "franchise", "Atlases/franchise", -7, -16); // futile done initing FSoundManager.PlayMusic("song"); FPWorld.Create(64.0f); // make the walls super thick so stuff doesn't accidentally fly through when forces are massive float wallThickness = 100000; WTBasicWall leftWall = new WTBasicWall(wallThickness, Futile.screen.height * 10); WTBasicWall rightWall = new WTBasicWall(wallThickness, Futile.screen.height * 10); WTBasicWall bottomWall = new WTBasicWall(Futile.screen.width * 10, wallThickness); WTBasicWall topWall = new WTBasicWall(Futile.screen.width * 10, wallThickness); leftWall.SetPosition(-wallThickness / 2f + 10, Futile.screen.halfHeight); rightWall.SetPosition(Futile.screen.width + wallThickness / 2f - 10, Futile.screen.halfHeight); bottomWall.SetPosition(Futile.screen.halfWidth, -wallThickness / 2f + 10); topWall.SetPosition(Futile.screen.halfWidth, Futile.screen.height + wallThickness / 2f - 10); Futile.stage.AddChild(leftWall); Futile.stage.AddChild(rightWall); Futile.stage.AddChild(bottomWall); Futile.stage.AddChild(topWall); physicsNodes = new List <WTPhysicsNode>(); // create the square FSprite squareSprite = new FSprite("coolSquare"); square = new WTPhysicsNode("square"); square.AddChild(squareSprite); square.SetNewPosition(Futile.screen.width / 4f, Futile.screen.halfHeight); square.physicsComponent.AddBoxCollider(squareSprite.width, squareSprite.height); physicsNodes.Add(square); // create the circle FSprite circleSprite = new FSprite("coolCircle"); circle = new WTPhysicsNode("circle"); circle.AddChild(circleSprite); circle.SetNewPosition(Futile.screen.width / 4f * 2f, Futile.screen.halfHeight); circle.physicsComponent.AddSphereCollider(circleSprite.width / 2f); physicsNodes.Add(circle); // polygon object FSprite polygonSprite = new FSprite("coolPolygon"); polygon = new WTPhysicsNode("polygon"); polygon.AddChild(polygonSprite); polygon.SetNewPosition(Futile.screen.width / 4f * 3f, Futile.screen.halfHeight); Vector2[] vertices = new Vector2[] { new Vector2(-27, -10), new Vector2(-14, 6), new Vector2(-20, 24), new Vector2(-2, 11), new Vector2(27, 25), new Vector2(-7, -8), new Vector2(22, -17), new Vector2(-26, -27) }; polygon.physicsComponent.AddPolygonalCollider(vertices); physicsNodes.Add(polygon); // setup all the objects and start their physics foreach (WTPhysicsNode pn in physicsNodes) { pn.physicsComponent.AddRigidBody(1, 1); pn.physicsComponent.SetupPhysicMaterial(0.9f, 0.1f, 0.1f, PhysicMaterialCombine.Maximum); pn.physicsComponent.StartPhysics(); pn.physicsComponent.AddForce(Random.Range(-1000, 1000), Random.Range(-1000, 1000)); Futile.stage.AddChild(pn); } // for fun, let's stop this and have it float around a bit before being controlled by physics polygon.physicsComponent.StopPhysics(); }