Newer
Older
kotlin-use-kudens-js-lib / web / js / generated / KotlinTest.js
if (typeof kotlin === 'undefined') {
  throw new Error("Error loading module 'KotlinTest'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'KotlinTest'.");
}
if (typeof kudens === 'undefined') {
  throw new Error("Error loading module 'KotlinTest'. Its dependency 'kudens' was not found. Please, check whether 'kudens' is loaded prior to 'KotlinTest'.");
}
var KotlinTest = function (_, Kotlin, $module$kudens) {
  'use strict';
  var sound_0 = $module$kudens.games.perses.sound;
  var texture_0 = $module$kudens.games.perses.texture;
  var game_0 = $module$kudens.games.perses.game;
  var input_0 = $module$kudens.games.perses.input;
  var text_0 = $module$kudens.games.perses.text;
  var Screen = $module$kudens.games.perses.game.Screen;
  var SpriteBatch = $module$kudens.games.perses.sprite.SpriteBatch;
  var Sprite = $module$kudens.games.perses.sprite.Sprite;
  var Sound = $module$kudens.games.perses.sound.Sound;
  var DrawMode = $module$kudens.games.perses.game.DrawMode;
  WelcomeScreen.prototype = Object.create(Screen.prototype);
  WelcomeScreen.prototype.constructor = WelcomeScreen;
  function WelcomeScreen() {
    Screen.call(this);
    this.sprites = new SpriteBatch();
    this.sprite = new Sprite('SHIP');
    this.music = null;
    this.sound = new Sound('BOOM', 'sounds/Explosion7.ogg', 1.0, 2);
    this.time = 0.0;
    this.x = 500.0;
    this.y = 500.0;
    this.red = 0.0;
    this.green = 0.0;
    this.blue = 0.0;
    this.alpha = 0.0;
    this.size = 0.0;
    this.spaceDown = false;
  }
  WelcomeScreen.prototype.loadResources = function () {
    this.music = sound_0.Music.play_1truf$('music/DST-TechnoBasic.mp3', 1.0, true);
    texture_0.Textures.load_puj7f4$('SHIP', 'images/ship2.png');
    this.x = game_0.Game.view.width / 2.0;
  };
  WelcomeScreen.prototype.update_dleff0$ = function (time, delta) {
    this.time = time;
    this.red = 200 + Math.sin(time * 3.0) * 50.0;
    this.green = 200 + Math.sin(time * 5.0) * 50.0;
    this.blue = 200 + Math.sin(time * 7.0) * 50.0;
    this.alpha = 0.5 + Math.sin(time * 11.0) * 0.5;
    this.size = 60 + Math.sin(time) * 20;
    if (input_0.Keys.isDown_za3lpa$(37)) {
      this.x -= 200 * delta;
    }
    if (input_0.Keys.isDown_za3lpa$(39)) {
      this.x += 200 * delta;
    }
    if (input_0.Keys.isDown_za3lpa$(38)) {
      this.y += 200 * delta;
    }
    if (input_0.Keys.isDown_za3lpa$(40)) {
      this.y -= 200 * delta;
    }
    if (input_0.Keys.isDown_za3lpa$(32)) {
      if (!this.spaceDown) {
        this.sound.play();
        this.spaceDown = true;
      }
    }
     else {
      this.spaceDown = false;
    }
  };
  WelcomeScreen.prototype.render = function () {
    text_0.Texts.drawText_k35s1u$(5.0, 40.0, 'Hello! FPS ' + game_0.Game.fps, 'bold 24pt Arial', 'rgba(0, 255, 0, 1)');
    this.sprites.draw_kjwdzj$(this.sprite, this.x, this.y, 7.0 + Math.sin(this.time) * 6.0, this.time);
    this.sprites.render();
  };
  WelcomeScreen.$metadata$ = {
    kind: Kotlin.Kind.CLASS,
    simpleName: 'WelcomeScreen',
    interfaces: [Screen]
  };
  function main(args) {
    game_0.Game.view.setToHeight_mx4ult$(1080.0);
    game_0.Game.view.drawMode = DrawMode.NEAREST;
    game_0.Game.view.minAspectRatio = 1920.0 / 1080.0;
    game_0.Game.view.maxAspectRatio = 1920.0 / 1080.0;
    game_0.Game.start_lbnb05$(new WelcomeScreen());
  }
  var package$games = _.games || (_.games = {});
  var package$perses = package$games.perses || (package$games.perses = {});
  var package$shooter = package$perses.shooter || (package$perses.shooter = {});
  package$shooter.WelcomeScreen = WelcomeScreen;
  package$shooter.main_kand9s$ = main;
  Kotlin.defineModule('KotlinTest', _);
  main([]);
  return _;
}(typeof KotlinTest === 'undefined' ? {} : KotlinTest, kotlin, kudens);

//@ sourceMappingURL=KotlinTest.js.map