public void addItemBackground(CGPoint itemPos) { var bottleCap = new SKSpriteNode(SKTexture.FromImageNamed("capitem1")); bottleCap.SetScale(0.4f); bottleCap.Position = itemPos; AddChild(bottleCap); }
void AddLight () { SKSpriteNode sprite = new SKSpriteNode ("Art/spark.png") { Position = GetRandomPosition (), BlendMode = SKBlendMode.Add, Alpha = 0.5f }; sprite.SetScale (2f); Scene.AddChild (sprite); }
void AddLight() { SKSpriteNode sprite = new SKSpriteNode("Art/spark.png") { Position = GetRandomPosition(), BlendMode = SKBlendMode.Add, Alpha = 0.5f }; sprite.SetScale(2f); Scene.AddChild(sprite); }
void AddAnchorGrid () { for (int x = 0; x <= 4; x++) { for (int y = 0; y <= 4; y++) { SKSpriteNode sprite = new SKSpriteNode ("Art/rocket.png") { AnchorPoint = new CGPoint (0.25f * x, 0.25f * y), Position = new CGPoint (Scene.Frame.GetMidX () - 400 + 100 * x, Scene.Frame.GetMidY () - 200 + 100 * y) }; sprite.SetScale (0.25f); Scene.AddChild (sprite); AddAnchorDotToSprite (sprite); } } }
protected override void CreateSceneContents() { base.CreateSceneContents(); template = new SKSpriteNode("Art/rocket.png"); template.SetScale(0.5f); AddBlendFactorLabels(); AddColorRow(UIColor.Red, 0); AddColorRow(UIColor.Green, 1); AddColorRow(UIColor.Blue, 2); AddColorRow(UIColor.Yellow, 3); AddAnimatedSprite(); }
protected override void CreateSceneContents() { base.CreateSceneContents (); template = new SKSpriteNode ("Art/rocket.png"); template.SetScale (0.5f); AddBlendFactorLabels (); AddColorRow (UIColor.Red, 0); AddColorRow (UIColor.Green, 1); AddColorRow (UIColor.Blue, 2); AddColorRow (UIColor.Yellow, 3); AddAnimatedSprite (); }
public SelectaScene(CGSize size) : base(size) { BackgroundColor = UIColor.White; _camNode.Size = new CGSize(300, 300); _img1.Position = new CGPoint(52, Size.Height / 1.3f); _img2.Position = new CGPoint(Size.Width / 2, Size.Height / 1.3f); _img3.Position = new CGPoint(Size.Width - 52, Size.Height / 1.3f); _camNode.Position = new CGPoint(Size.Width / 2, Size.Height / 2.7f); _camNodeFrame.Position = new CGPoint(_camNode.Position.X, _camNode.Position.Y - 14); nodeScaling(_camNode); nodeScaling(_camNodeFrame); AddChild(_camNodeFrame); AddChild(_camNode); AddChild(_img1); AddChild(_img2); AddChild(_img3); _menuButton.Position = new CGPoint(Size.Width / 6, Size.Height - 55); AddChild(_menuButton); currentSelected = 1; movePin(_img1.Position); _pushPin.SetScale(0.9f); _pushPin.ZRotation = -0.5f; AddChild(_pushPin); loadStartUpHater(); // if (GameObj.mImage1 != null) { // currentSelected = 1; // var im = GameObj.mImage1;//UIImage.FromFile ("chicken1"); // loadHater (im); // } }
public override void MouseDown(NSEvent theEvent) { // Called when a mouse click occurs var location = theEvent.LocationInNode(this); SKSpriteNode sprite = SKSpriteNode.FromImageNamed("person"); //var sprite = SKSpriteNode.FromImageNamed(NSBundle.MainBundle.PathForResource("Spaceship", "png")); sprite.Position = location; sprite.SetScale(10); var action = SKAction.MoveBy(2, 2, 0.1); sprite.RunAction(SKAction.RepeatActionForever(action)); //sprite.RunAction(SKAction.RepeatActionForever(action)); AddChild(sprite); }
void AddAnchorGrid() { for (int x = 0; x <= 4; x++) { for (int y = 0; y <= 4; y++) { SKSpriteNode sprite = new SKSpriteNode("Art/rocket.png") { AnchorPoint = new CGPoint(0.25f * x, 0.25f * y), Position = new CGPoint(Scene.Frame.GetMidX() - 400 + 100 * x, Scene.Frame.GetMidY() - 200 + 100 * y) }; sprite.SetScale(0.25f); Scene.AddChild(sprite); AddAnchorDotToSprite(sprite); } } }
public async void loadHater() { if (GameObj.finalImage != null) { await System.Threading.Tasks.Task.Delay(2000); //RemoveAllChildren (); _spriteFrame = new SKSpriteNode(SKTexture.FromImageNamed("framecopycopy")); _spriteFrame.Position = new CGPoint(Scene.Size.Width / 2, Scene.Size.Height - (Scene.Size.Height / 3.77f) - 11); _spriteFrame.SetScale(0.6f); AddChild(_spriteFrame); PhotoNode = new SKSpriteNode(SKTexture.FromImage(GameObj.finalImage)); //Frage (xy.hater));//(UIColor.DarkGray,new CGSize(200f,200f)); PhotoNode.Size = new CGSize(120f, 120f); PhotoNode.Position = new CGPoint(Scene.Size.Width / 2, Scene.Size.Height - (Scene.Size.Height / 3.77f)); AddChild(PhotoNode); } }
private void SetInfoText() { int tempFontSize = 18; int tempInfoSize = 40; int tempInfoPos = 40; // Check which iOS device, change infobox text and size if (UIScreen.MainScreen.Bounds.Width < 375) { tempFontSize = 16; tempInfoSize = 20; tempInfoPos = 30; } // Define and add Label 1 infoLabel1 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "Hier kannst du gleich deine Emotion", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10) }; infoLabel1.Alpha = 0.0f; infoLabel1.Name = "infoLabel"; infoLabel1.ZPosition = 100; AddChild(infoLabel1); // Define and add Label 2 infoLabel2 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "erfassen indem du den Bildschirm berührst", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20) }; infoLabel2.Alpha = 0.0f; infoLabel2.Name = "infoLabel"; infoLabel2.ZPosition = 100; AddChild(infoLabel2); // Define and add Label 3 infoLabel3 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "navigiere die Kreise mit dem Finger", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10), }; infoLabel3.Alpha = 0.0f; infoLabel3.ZPosition = 100; infoLabel3.Name = "infoLabel"; AddChild(infoLabel3); // Define and add Label 4 infoLabel4 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "die Farbe und Bewegung verändert sich", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20), }; infoLabel4.Alpha = 0.0f; infoLabel4.ZPosition = 100; infoLabel4.Name = "infoLabel"; AddChild(infoLabel4); // Define and add Label 5 infoLabel5 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "wenn Farbe und Emotion übereinstimmen", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10), }; infoLabel5.Alpha = 0.0f; infoLabel5.ZPosition = 100; infoLabel5.Name = "infoLabel"; AddChild(infoLabel5); // Define and add Label 6 infoLabel6 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "hebe den Finger ab dem Bildschirm", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20), }; infoLabel6.Alpha = 0.0f; infoLabel6.Name = "infoLabel"; infoLabel6.ZPosition = 100; AddChild(infoLabel6); // Define and add Label 7 infoLabel7 = new SKLabelNode("AppleSDGothicNeo-Bold") { Text = "TEATIME", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 60), }; infoLabel7.Alpha = 0.0f; infoLabel7.Name = "infoLabel"; infoLabel7.ZPosition = 100; AddChild(infoLabel7); // Do Actions on the Label Nodes (wait, fade in, wait, fade out) DoActionSequenceOnNode(infoLabel1, 1, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel2, 2, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel3, 6, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel4, 7, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel5, 11, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel6, 12, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel7, 0, 1, 16, 1, 0.7f); // Define and add Info Box rect infoNode = new SKSpriteNode(); infoNode.Size = new CGSize(Frame.Width, Frame.Height); infoNode.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2); infoNode.Color = UIColor.FromHSB(0, 0, 0.3f); infoNode.ZPosition = 99; infoNode.Name = "infoNode"; infoNode.Alpha = 0.0f; AddChild(infoNode); // Define and add Info Box rect 2 infoNode2 = new SKSpriteNode(); infoNode2.Size = new CGSize(Frame.Width - 60, 130); infoNode2.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 25); infoNode2.Color = UIColor.FromHSB(0, 0, 0.3f); infoNode2.ZPosition = 98; infoNode2.Name = "infoNode"; infoNode2.Alpha = 0.0f; AddChild(infoNode2); // Define and add Info Box rect 3 infoNode3 = new SKSpriteNode(); infoNode3.Size = new CGSize(Frame.Width - tempInfoSize, 130); infoNode3.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 25); infoNode3.Color = UIColor.FromHSB(0, 0, 0.3f); infoNode3.ZPosition = 98; infoNode3.Name = "infoNode"; infoNode3.Alpha = 0.0f; AddChild(infoNode3); // Define and add Cancel Icon for the Info Box cancelSpark = new SKSpriteNode("sparkx"); cancelSpark.Name = "cancelSpark"; cancelSpark.ZPosition = 1000; cancelSpark.Alpha = 0.0f; cancelSpark.SetScale(0.6f); cancelSpark.Color = UIColor.FromHSB(0, 0, 0.0f); cancelSpark.Position = new CGPoint((View.Frame.Width - (tempInfoPos)), (View.Frame.Height / 2 + (70))); AddChild(cancelSpark); // Define and add Teatime Icon for the Info Box teatimeSprite = new SKSpriteNode("*****@*****.**"); teatimeSprite.Name = "infoNode"; teatimeSprite.ZPosition = 1000; teatimeSprite.Alpha = 0.0f; teatimeSprite.SetScale(0.35f); teatimeSprite.Color = UIColor.FromHSB(0, 0, 0.0f); teatimeSprite.Position = new CGPoint((0 + (tempInfoPos)), (View.Frame.Height / 2 + (70))); AddChild(teatimeSprite); // Actions and Sequence for Info Nodes DoActionSequenceOnNode(infoNode, 0, 1, 16, 1, 0.3f); DoActionSequenceOnNode(infoNode3, 0, 1, 16, 1, 0.3f); DoActionSequenceOnNode(cancelSpark, 0, 1, 16, 1, 0.3f); DoActionSequenceOnNode(teatimeSprite, 0, 1, 16, 1, 0.3f); }
public async void AnalyzeTouch() { var touchDiff = LastTouch.Y - FirstTouch.Y; var touchDiffX = LastTouch.X - FirstTouch.X; if (touchDiff > 66) { var sprite = new SKSpriteNode("dart_blue") { Position = new CGPoint( FirstTouch.X, -5f) }; //dart_blue // var sprite1 = new SKSpriteNode ("knife1") { // Position = new CGPoint( // FirstTouch.X,-5f ) // }; sprite.SetScale(1.5f); AddChild(sprite); var finaldest = new CGPoint(); var action = SKAction.MoveTo(finaldest, 0.3); if (touchDiff < 150) { finaldest = new CGPoint(LastTouch.X + (touchDiffX * 0.5f), LastTouch.Y + (touchDiff * 0.3f)); action = SKAction.MoveTo(finaldest, 0.3); //FollowPath (np, 3.0); } else { finaldest = new CGPoint(LastTouch.X + (touchDiffX * 0.5f), LastTouch.Y + (touchDiff * 0.6f)); action = SKAction.MoveTo(finaldest, 0.2); } nfloat rotatingAngle = touchDiffX / 333; Console.WriteLine("touchDiff:::" + touchDiffX); Console.WriteLine("toRadians:::" + rotatingAngle); //to radians var RotAction = SKAction.RotateToAngle(-rotatingAngle, 0); //to small size var scaleAction = SKAction.ScaleTo(0.8f, 0.1555); sprite.RunAction(action); sprite.RunAction(RotAction); sprite.RunAction(scaleAction); SpriteCount++; //COLLISION if (PhotoNode.ContainsPoint(finaldest)) { CurrentScore++; System.Diagnostics.Debug.WriteLine("POINTS: " + CurrentScore); System.Diagnostics.Debug.WriteLine("collideddddddd::::::::::::::::::::::"); await System.Threading.Tasks.Task.Delay(200); await System.Threading.Tasks.Task.Delay(200); var displayScoreNode = new SKLabelNode(); displayScoreNode.Text = "" + CurrentScore; //.ToString (); displayScoreNode.Position = new CGPoint(Size.Width / 2, (Size.Height / 2) - 200); displayScoreNode.FontSize = 80; displayScoreNode.FontColor = UIColor.Red; displayScoreNode.FontName = "GillSans-Bold"; displayScoreNode.SetScale(0.1f); var moveUpAction = SKAction.MoveTo((new CGPoint(Size.Width / 2, Size.Height / 2)), 0.5); var scaleUpAction = SKAction.ScaleBy(9f, 0.5); AddChild(displayScoreNode); displayScoreNode.RunAction(moveUpAction); displayScoreNode.RunAction(scaleUpAction); await System.Threading.Tasks.Task.Delay(1000); displayScoreNode.RemoveFromParent(); } else { await System.Threading.Tasks.Task.Delay(300); SystemSound.Vibrate.PlaySystemSound(); //.PlayAlertSound(); SystemSound.Vibrate.Close(); } //REMOVE SLOW DART if (touchDiff < 100) { await System.Threading.Tasks.Task.Delay(200); sprite.RemoveFromParent(); SpriteCount--; } if (touchDiff > 120 && (!PhotoFrameNode.ContainsPoint(finaldest))) { await System.Threading.Tasks.Task.Delay(300); SystemSound.Vibrate.PlaySystemSound(); //.PlayAlertSound(); SystemSound.Vibrate.Close(); await System.Threading.Tasks.Task.Delay(200); } } }
private void SetInfoText() { int tempFontSize = 18; int tempInfoSize = 40; int tempInfoPos = 40; // Check which iOS device, change infobox text and size if (UIScreen.MainScreen.Bounds.Width < 375) { tempFontSize = 16; tempInfoSize = 20; tempInfoPos = 30; } // Define and add Label 1 infoLabel1 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "Hier kannst du deine Emotion erfassen", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10) }; infoLabel1.Alpha = 0.0f; infoLabel1.Name = "infoLabel"; infoLabel1.ZPosition = 100; AddChild(infoLabel1); // Define and add Label 2 infoLabel2 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "suche eine passende Farbe", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20) }; infoLabel2.Alpha = 0.0f; infoLabel2.Name = "infoLabel"; infoLabel2.ZPosition = 100; AddChild(infoLabel2); // Define and add Label 3 infoLabel3 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "Berühre den Bildschirm", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10) }; infoLabel3.Alpha = 0.0f; infoLabel3.ZPosition = 100; infoLabel3.Name = "infoLabel"; AddChild(infoLabel3); // Define and add Label 4 infoLabel4 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "und navigiere die Punkte", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20) }; infoLabel4.Alpha = 0.0f; infoLabel4.ZPosition = 100; infoLabel4.Name = "infoLabel"; AddChild(infoLabel4); // Define and add Label 5 infoLabel5 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "so dass diese schlussendlich", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10) }; infoLabel5.Alpha = 0.0f; infoLabel5.ZPosition = 100; infoLabel5.Name = "infoLabel"; AddChild(infoLabel5); // Define and add Label 6 infoLabel6 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "deiner aktuellen Gefühlslage entsprechen", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20) }; infoLabel6.Alpha = 0.0f; infoLabel6.Name = "infoLabel"; infoLabel6.ZPosition = 100; AddChild(infoLabel6); // Define and add Label 7 infoLabel7 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "wenn du die Punkte lange drückst", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 10) }; infoLabel7.Alpha = 0.0f; infoLabel7.ZPosition = 100; infoLabel7.Name = "infoLabel"; AddChild(infoLabel7); // Define and add Label 8 infoLabel8 = new SKLabelNode("AppleSDGothicNeo-UltraLight") { Text = "kannst du diese verändern", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 - 20) }; infoLabel8.Alpha = 0.0f; infoLabel8.Name = "infoLabel"; infoLabel8.ZPosition = 100; AddChild(infoLabel8); // Define and add Label 9 infoLabel9 = new SKLabelNode("AppleSDGothicNeo-Bold") { Text = "TEATIME", FontSize = tempFontSize, Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 60) }; infoLabel9.Alpha = 0.0f; infoLabel9.Name = "infoLabel"; infoLabel9.ZPosition = 100; AddChild(infoLabel9); // Do Actions on the Label Nodes (wait, fade in, wait, fade out) DoActionSequenceOnNode(infoLabel1, 1, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel2, 2, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel3, 6, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel4, 7, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel5, 11, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel6, 12, 1, 2, 1, 0.8f); DoActionSequenceOnNode(infoLabel7, 16, 1, 2, 1, 0.7f); DoActionSequenceOnNode(infoLabel8, 17, 1, 2, 1, 0.7f); DoActionSequenceOnNode(infoLabel9, 0, 1, 20, 1, 0.7f); // Define and add Info Box rect infoNode = new SKSpriteNode(); infoNode.Size = new CGSize(Frame.Width, Frame.Height); infoNode.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2); infoNode.Color = UIColor.FromHSB(0, 0, 0.3f); infoNode.ZPosition = 99; infoNode.Name = "infoNode"; infoNode.Alpha = 0.0f; AddChild(infoNode); // Define and add Info Box rect 2 infoNode2 = new SKSpriteNode(); infoNode2.Size = new CGSize(Frame.Width - 60, 130); infoNode2.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 25); infoNode2.Color = UIColor.FromHSB(0, 0, 0.3f); infoNode2.ZPosition = 98; infoNode2.Name = "infoNode"; infoNode2.Alpha = 0.0f; AddChild(infoNode2); // Define and add Info Box rect 3 infoNode3 = new SKSpriteNode(); infoNode3.Size = new CGSize(Frame.Width - tempInfoSize, 130); infoNode3.Position = new CGPoint(Frame.Width / 2, Frame.Height / 2 + 25); infoNode3.Color = UIColor.FromHSB(0, 0, 0.3f); infoNode3.ZPosition = 98; infoNode3.Name = "infoNode"; infoNode3.Alpha = 0.0f; AddChild(infoNode3); // Define and add Cancel Icon for the Info Box cancelSpark = new SKSpriteNode("sparkx"); cancelSpark.Name = "cancelSpark"; cancelSpark.ZPosition = 1000; cancelSpark.Alpha = 0.0f; cancelSpark.SetScale(0.6f); cancelSpark.Color = UIColor.FromHSB(0, 0, 0.0f); cancelSpark.Position = new CGPoint((View.Frame.Width - (tempInfoPos)), (View.Frame.Height / 2 + (70))); AddChild(cancelSpark); // Define and add Teatime Icon for the Info Box teatimeSprite = new SKSpriteNode("*****@*****.**"); teatimeSprite.Name = "infoNode"; teatimeSprite.ZPosition = 1000; teatimeSprite.Alpha = 0.0f; teatimeSprite.SetScale(0.35f); teatimeSprite.Color = UIColor.FromHSB(0, 0, 0.0f); teatimeSprite.Position = new CGPoint((0 + (tempInfoPos)), (View.Frame.Height / 2 + (70))); AddChild(teatimeSprite); // Actions and Sequence for Info Nodes DoActionSequenceOnNode(infoNode, 0, 1, 20, 1, 0.3f); DoActionSequenceOnNode(infoNode3, 0, 1, 20, 1, 0.3f); DoActionSequenceOnNode(cancelSpark, 0, 1, 20, 1, 0.3f); DoActionSequenceOnNode(teatimeSprite, 0, 1, 20, 1, 0.3f); }