<commit_before>﻿/// <reference path="../../../../dist/Excalibur.d.ts"/>

var game = new ex.Engine(500, 500, "game");
var box = new ex.Actor(250, 250, 100, 100, ex.Color.Red);

// Enable Gamepad support
game.input.gamepads.enabled = true;

// Move box with Up, Down, Left, Right keyboard keys
// Move box with Gamepad axes and D-pad
box.on("update", (ue: ex.UpdateEvent) => {

   var pad1 = game.input.gamepads.at(0);
   var axesLeftX = pad1.getAxes(ex.Input.Axes.LeftStickX);
   var axesLeftY = pad1.getAxes(ex.Input.Axes.LeftStickY);

   // Right/Left
   if (game.input.keyboard.isKeyPressed(ex.Input.Keys.Right) ||
       pad1.isButtonPressed(ex.Input.Buttons.DpadRight)) {
      box.dx = 20;
   } else if (game.input.keyboard.isKeyPressed(ex.Input.Keys.Left) ||
      pad1.isButtonPressed(ex.Input.Buttons.DpadLeft)) {
      box.dx = -20;
   } else if (!axesLeftX && !axesLeftY) {
      box.dx = 0;
   }

   // Up/Down
   if (game.input.keyboard.isKeyPressed(ex.Input.Keys.Up) ||
       pad1.isButtonPressed(ex.Input.Buttons.DpadUp)) {
      box.dy = -20;
   } else if (game.input.keyboard.isKeyPressed(ex.Input.Keys.Down) ||
      pad1.isButtonPressed(ex.Input.Buttons.DpadDown)) {
      box.dy = 20;
   } else if (!axesLeftY && !axesLeftX) {
      box.dy = 0;
   }

   // Axes movement
   if (Math.abs(axesLeftX) > 0) {
      box.dx = axesLeftX * 120;
   }
   if (Math.abs(axesLeftY) > 0) {
      box.dy = axesLeftY * 120;
   }
});

game.add(box);

game.start();<commit_msg>update input method name to be consistent with new api<commit_after>﻿/// <reference path="../../../../dist/Excalibur.d.ts"/>

var game = new ex.Engine(500, 500, "game");
var box = new ex.Actor(250, 250, 100, 100, ex.Color.Red);

// Enable Gamepad support
game.input.gamepads.enabled = true;

// Move box with Up, Down, Left, Right keyboard keys
// Move box with Gamepad axes and D-pad
box.on("update", (ue: ex.UpdateEvent) => {

   var pad1 = game.input.gamepads.at(0);
   var axesLeftX = pad1.getAxes(ex.Input.Axes.LeftStickX);
   var axesLeftY = pad1.getAxes(ex.Input.Axes.LeftStickY);

   // Right/Left
   if (game.input.keyboard.isHeld(ex.Input.Keys.Right) ||
       pad1.isButtonPressed(ex.Input.Buttons.DpadRight)) {
      box.dx = 20;
   } else if (game.input.keyboard.isHeld(ex.Input.Keys.Left) ||
      pad1.isButtonPressed(ex.Input.Buttons.DpadLeft)) {
      box.dx = -20;
   } else if (!axesLeftX && !axesLeftY) {
      box.dx = 0;
   }

   // Up/Down
   if (game.input.keyboard.isHeld(ex.Input.Keys.Up) ||
       pad1.isButtonPressed(ex.Input.Buttons.DpadUp)) {
      box.dy = -20;
   } else if (game.input.keyboard.isHeld(ex.Input.Keys.Down) ||
      pad1.isButtonPressed(ex.Input.Buttons.DpadDown)) {
      box.dy = 20;
   } else if (!axesLeftY && !axesLeftX) {
      box.dy = 0;
   }

   // Axes movement
   if (Math.abs(axesLeftX) > 0) {
      box.dx = axesLeftX * 120;
   }
   if (Math.abs(axesLeftY) > 0) {
      box.dy = axesLeftY * 120;
   }
});

game.add(box);

game.start();
{'fraction_non_alphanumeric': 0.1727731092436975, 'fraction_numerical': 0.02957983193277311, 'mean_word_length': 2.72, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2114702', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1155, 'n_words': 212}