public void attack() { actionFrame = 0; //currentAction = PlayerAction.attacking; Random r = new Random(); int h = r.Next(1, 5); switch (h) { case (1): TCM_Audio.playWAV("pewDown2"); break; case (2): TCM_Audio.playWAV("pewDown1"); break; case (3): TCM_Audio.playWAV("pew"); break; case (4): TCM_Audio.playWAV("pewUp1"); break; case (5): TCM_Audio.playWAV("pewUp2"); break; } }
public static void runLoop() { startUp(); RenderLoop.Run(TCM_Graphics.form, step); TCM_Audio.clear(); TCM_Graphics.dispose(); TCM_Audio.disposeAudio(); }
public void jump() { if (grounded) { ySpeed = -jumpStrength; jumpFrame = 10; TCM_Audio.playWAV("grunt"); } }
public static void step() { TCM_Audio.cleanOutSources(); TCM_Graphics.beginDraw(); control.storeInputs(); bool playing = true; if (playing) { if (getButton(ButtonEnum.rb) == ButtonState.down || getButton(ButtonEnum.rb) == ButtonState.pressed) { control.vib.RightMotorSpeed = (ushort)(getAnalog(AnalogEnum.rt) * 65535); control.setVibration(control.vib); } if (getButton(ButtonEnum.lb) == ButtonState.down || getButton(ButtonEnum.lb) == ButtonState.pressed) { control.vib.LeftMotorSpeed = (ushort)(getAnalog(AnalogEnum.lt) * 65535); control.setVibration(control.vib); } if (getButton(ButtonEnum.start) == ButtonState.pressed) { paused = !paused; /*if (paused) * TCM_Audio.pauseAllAudio(); * else * TCM_Audio.resumeAllAudio();*/ } if (!paused) { //put game code here currentRoom.step(); frameCount++; } else { //put menu code here currentRoom.draw(); pause.draw(); if (getButton(ButtonEnum.back) == ButtonState.pressed) { TCM_Graphics.form.Close(); } } } control.storeGamepad(); TCM_Graphics.endDraw(); Thread.Sleep(20); }
private static void startUp() { frameCount = 0; TCM_Graphics.Initialize("Game", 1920, 1080, new Color(0, 0, 0, 1)); TCM_Audio.Initialize(); rooms = new List <Room>(); rooms.Add(new Room(2, 1, true)); currentRoom = rooms[0]; currentRoom.initialize(); pause = new Frame(); //working on it, does scrolly text, needs to be able to reset //ProgressingTextVisual pauseText = new ProgressingTextVisual("PAUSED - back to quit\ntesting how much text i can fit in this box" // + "\napparently that wasn't enough, so i'll just keep adding until something weird starts happening", new Color(1, 1, 1, 1)); //pauseText.setBoundingBox(490, 280, 940, 520); //pauseText.setFormat("Consolas", 32); //List<ProgressingTextVisual> scrolly = new List<ProgressingTextVisual>(); //scrolly.Add(pauseText); TextVisual pauseText = new TextVisual("PAUSED - back to quit\ntesting how much text i can fit in this box" + "\napparently that wasn't enough, so i'll just keep adding until something weird starts happening", new Color(1, 1, 1, 1)); pauseText.setBoundingBox(490, 280, 940, 520); pauseText.setFormat(pauseText.format.FontFamilyName, 32); pauseText.setFormat("Consolas", 32); BitmapVisual pauseBitmap = new BitmapVisual(TCM_Graphics.loadPNG("blank"), 480, 270, 960, 540); pauseBitmap.setTransparency(.5f); pause.addVisual(pauseBitmap); pause.addVisual(pauseText); if (new Controller() != null) { control = new TCM_Controller(new Controller(UserIndex.One)); control.LSDeadZone = .18; control.RSDeadZone = .18; control.axialLeft = false; control.axialRight = false; } else { } }