Guest User

Untitled

a guest
Jul 31st, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2. using CocosNet.Layers;
  3. using CocosNet.Labels;
  4. using System.Drawing;
  5. using CocosNet;
  6. using CocosNet.Menus;
  7. using MonoTouch.UIKit;
  8. using CocosNet.Support;
  9. using CocosNet.Sprites;
  10. using CocosNet.Actions;
  11.  
  12. namespace MyTest
  13. {
  14. public class BallScene : ColorLayer
  15. {
  16. protected Sprite ball;
  17.  
  18. public BallScene ()
  19. {
  20. SizeF s = Director.Instance.WinSize;
  21.  
  22. //Заголовок
  23. Label label = new Label("Прыгающий мячик", "Arial", 32);
  24. label.SetPosition(s.Width / 2f, s.Height - 50);
  25. AddChild(label, 9999);
  26.  
  27. //Кнопка для меню
  28. MenuItemImage item1 = new MenuItemImage("button.png", "button.png");
  29. item1.Click += HandleItem1Click;
  30.  
  31. //Меню
  32. Menu menu = new Menu(item1);
  33. menu.SetPosition(s.Width / 2f, s.Height - 150);
  34. AddChild(menu, 9999);
  35.  
  36. //Мяч
  37. ball = new Sprite("ball.png");
  38. ball.SetPosition(50, 50);
  39. AddChild(ball, 1);
  40. }
  41.  
  42. void HandleItem1Click (object sender, EventArgs e)
  43. {
  44. //MessageBox.Show("Кнопка нажата", "Привет!");
  45.  
  46. var jump = new JumpBy(2, new PointF(230, 0), 50, 5);
  47. ball.RunAction(new Sequence(jump, jump.Reverse() as IntervalAction));
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment