Skip to content

Commit

Permalink
WIP2
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarrough committed Feb 5, 2021
1 parent 703c0b5 commit 035b40b
Show file tree
Hide file tree
Showing 4 changed files with 472 additions and 107 deletions.
3 changes: 3 additions & 0 deletions public/game/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function generateGraph(opts) {
}
const options = Object.assign(defaultOptions, opts)
// if (options.maxEncounters > options.columns) options.maxEncounters = options.columns
console.log('Generating graph', options)

function Node(type = false) {
return {type, edges: new Set()}
Expand Down Expand Up @@ -184,6 +185,8 @@ const isEncounter = (node) => node && Boolean(node.type)
// Since el.offsetLeft doesn't respect CSS transforms,
// and getBounding.. is relative to viewport, not parent, we need this utility.
function getPosWithin(el, container) {
if (!el) throw new Error('missing el')
if (!container) throw new Error('missing container')
const parent = container.getBoundingClientRect()
const rect = el.getBoundingClientRect()
return {
Expand Down
3 changes: 1 addition & 2 deletions public/ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ Welcome to the Slay The Web Console. Some examples:
stw.game.state.player.maxHealth = 999; stw.update()
stw.game.enqueue({type: 'drawCards', amount: 2})
stw.update()
stw.dealCards()
`)
stw.dealCards()`)
window.stw = {
game: this.game,
update: this.update.bind(this),
Expand Down

0 comments on commit 035b40b

Please sign in to comment.