public WaterTile(TextureInfo texInfo) : base(texInfo) { _timer = new Timer(); _delay = 3000; _timer.Reset(); }
public static void Main(string[] args) { Initialize(); while (loop) { timePassed += (float)(timer.Milliseconds()) - previousTime; previousTime = (float)timer.Milliseconds(); if (timePassed > (1000 / 60)) //60Hz { timePassed = 0; previousTime = 0; timer.Reset(); SystemEvents.CheckEvents(); Update(); Render(); } } Term(); }
public static void Init() { ex = new List<Texture2D>(); ex.Add(new Texture2D("/Application/textures/ex0.png", false)); ex.Add(new Texture2D("/Application/textures/ex1.png", false)); ex.Add(new Texture2D("/Application/textures/ex2.png", false)); ex.Add(new Texture2D("/Application/textures/ex3.png", false)); ex.Add(new Texture2D("/Application/textures/ex4.png", false)); ex.Add(new Texture2D("/Application/textures/ex5.png", false)); ex.Add(new Texture2D("/Application/textures/ex6.png", false)); ex.Add(new Texture2D("/Application/textures/ex7.png", false)); ex.Add(new Texture2D("/Application/textures/ex8.png", false)); ex.Add(new Texture2D("/Application/textures/ex9.png", false)); ex.Add(new Texture2D("/Application/textures/ex10.png", false)); ex.Add(new Texture2D("/Application/textures/ex11.png", false)); ballTexture = new Texture2D("/Application/textures/ss.png", false); ballTexture1 = new Texture2D("/Application/textures/^.png", false); backGround = new Texture2D("/Application/textures/bg.png", false); backGround1 = new Texture2D("/Application/textures/bgw.png", false); player = new PlayerClass(); player.bounds = new Vector2( Director.Instance.GL.Context.GetViewport().Width, Director.Instance.GL.Context.GetViewport().Height); cleanuptimer = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer(); cleanuptimer.Reset(); timer = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer(); timer.Reset(); timer1 = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer(); counter = 0; FPS=0; firable = true; rand = new Random(); uppercorner = new Vector2(scene.Camera.CalcBounds().Center.X-460,scene.Camera.CalcBounds().Center.Y+220); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; //init score img = new Image(ImageMode.Rgba, new ImageSize(width/3,height/10), new ImageColor(255,255,0,0)); img.DrawText("Score: "+score.ToString()+"\nHighscore: "+highscore.ToString(), new ImageColor(255,0,0,255), new Font(FontAlias.System,20,FontStyle.Regular), new ImagePosition(0,0)); texturet = new Texture2D(width/3,height/10,false, PixelFormat.Rgba); texturet.SetPixels(0,img.ToBuffer()); img.Dispose(); dead = new List<SimpleDead>(); for(int x = 0; x < 20; x++){ dead.Add(new SimpleDead(ex,player.position,player.bounds)); } shots = new List<ShotClass>(); for(int x = 0; x < 100; x++){ shots.Add(new ShotClass(player.position,Input2.GamePad0.AnalogRight,player.bounds)); } enemies = new List<EnemyClass>(); for(int x = 0; x < 30; x++){ enemies.Add(new SimpleEnemy(player.bounds)); } oThread = new Thread(new ThreadStart(Updating1)); oThread.Start(); pThread= new Thread( new ThreadStart(Updating2)); pThread.Start(); }