~kylep/blunder_crawl

bcc1d3412c1a63e418dc324012d7df772ed5910e — Kyle Perik 2 years ago 818f90c
Tweaks
2 files changed, 11 insertions(+), 6 deletions(-)

M src/main.js
M src/menu.js
M src/main.js => src/main.js +2 -2
@@ 69,7 69,7 @@ document.body.appendChild(app.view)
window.app = app

export let gameData = {
  debug: true,
  debug: false,
  camera: new Vec(0, 0),
  height: height,
  width: width,


@@ 157,7 157,7 @@ export function getEnemyType (i) {
function buildRoom () {
  gameData.i = 0
  removeUpgradeChoices()
  gameData.enemies = range(Math.floor((Math.random() + .5) * (Math.sqrt(gameData.level) * 3.5)) + 1).reduce((result, i) => {
  gameData.enemies = range(Math.floor((Math.random() + .5) * (Math.sqrt(gameData.level) * 3.5)) + 3).reduce((result, i) => {
    const pos = new Vec(Math.floor(Math.random() * 8) + 1, Math.floor(Math.random() * 6) + 1)
    if (pos.eq(gameData.player.pos) || result.find(enemy => enemy.pos.eq(pos))) {
      return result

M src/menu.js => src/menu.js +9 -4
@@ 1,9 1,11 @@
import * as PIXI from 'pixi.js'
import {getSprite} from './sprites'
import {app, start, tutorial, easeOutVeryLong, easeOutLong, easeOut} from './main'

export default class Menu {
  constructor () {
    this.g = new PIXI.Graphics()

    app.stage.addChild(this.g)
    this.title = new PIXI.BitmapText('Blunder Crawl', {
      fontName: 'MatchupPro',


@@ 31,7 33,7 @@ export default class Menu {
        gameData.menu = null
        app.stage.removeChild(this.g)
      })
    })
    }, getSprite(9, 1))
    this.addButton('tutorial', (button) => {
      if (this.started) {
        return


@@ 44,10 46,10 @@ export default class Menu {
        gameData.menu = null
        app.stage.removeChild(this.g)
      })
    })
    }, getSprite(33, 25))
  }

  addButton (name, action) {
  addButton (name, action, sprite) {
    const newButton = new PIXI.BitmapText(name, {
      fontName: 'MatchupPro',
      tint: hsv(0, 0, 1),


@@ 57,7 59,10 @@ export default class Menu {
    newButton.x = 12 * 6
    newButton.y = 12 * 7 + this.buttons.length * 12 * 1.5
    this.g.addChild(newButton)
    newButton.hitArea = new PIXI.Rectangle(0, 6, 12 * 5, 12 * 1)
    newButton.addChild(sprite)
    sprite.x = -12 - 6
    sprite.y = 4
    newButton.hitArea = new PIXI.Rectangle(-12 - 6, 6, 12 * 5, 12 * 1)
    newButton.interactive = true
    newButton.click = () => {
      action(newButton)