This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(local editor (require :polywell)) | |
(local fennel (require :polywell.lib.fennel)) | |
(local fmt (require :polywell.lib.fnlfmt)) | |
(local completion (require :polywell.completion)) | |
;; from here -- https://github.com/oakmac/parinfer-lua | |
(local parinfer (require :lib.parinfer)) | |
(local inspect (require :lib.inspect)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GRID_TILE_HEIGHT, GRID_TILE_WIDTH } from "../../constants"; | |
import { addxy, left, midpoint, xy } from "../../utils"; | |
import { BattleActorObject } from "../BattleActorObject"; | |
import { damageNumbers } from "../effects/damageNumbers"; | |
import { Sequence } from "./sequence"; | |
export const respawnSequence: Sequence<{ | |
actor: BattleActorObject, | |
x: number, | |
y: number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(λ do-attack [action] | |
(set action.to.animating true) | |
(set action.from.animating true) | |
(process-trigger-queue) | |
(let [mp (action.to.pos:midpoint action.from.pos)] | |
(timeline.parallel-tween | |
[0.5 action.to {:pos mp} :outBounce] | |
[0.5 action.from {:pos mp} :outBounce])) | |
(set action.from.animating false) | |
(set action.to.animating false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(λ do-attack [action] | |
(set action.to.animating true) | |
(set action.from.animating true) | |
(process-trigger-queue) | |
(let [mp (action.to.pos:midpoint action.from.pos)] | |
(timeline.parallel-tween | |
[0.5 action.from {:pos action.to.pos} :outBounce])) | |
;[0.5 action.from {:pos mp} :outBounce])) | |
(set action.from.animating false) | |
(set action.to.animating false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; A smalltalk inspired object system for lua and Fennel | |
;; Where all operations are implemented via message passing | |
(local MethodTable {}) | |
(set MethodTable.__index MethodTable) | |
(fn MethodTable.dispatch-effect [self k obj ...] | |
(when (self:get k) | |
((self:get k) obj ...)) | |
(each [_ ref (pairs self.refs)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn party-has? [type] | |
(let [team (get-team-list :player)] | |
(accumulate [result false _ {: actor} (ipairs team) | |
:until result] | |
(and actor (= actor.type type))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Redux style state management | |
(local initial-state | |
{:screen nil | |
:energy 0 | |
:deck (icollect [_ ct (ipairs [:scout :warrior :healer :archer :scout :scout :scout])] | |
(make-card ct)) | |
:hand [] | |
:field [] | |
:discard []}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require-macros :golly) | |
(local golly (require :golly)) | |
(defentity test-entity [self props] | |
{:x 300 :y 200 :width 200 :height 200} | |
(mixins (golly.mixins.mouse-interaction)) | |
(field :state | |
(statemachine :red | |
(transitions | |
(turn-red {:to :red}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def start-grid [[0 0 0 0 0 1 0 0 0 0] | |
[0 0 0 0 1 0 0 0 0 0] | |
[0 0 0 0 1 0 0 0 1 0] | |
[0 0 0 0 0 0 0 0 1 0] | |
[0 0 0 0 0 0 0 0 1 0] | |
[0 0 0 0 0 0 0 0 0 0] | |
[0 0 0 0 0 1 1 0 0 0] | |
[0 0 1 0 0 1 1 0 0 0] | |
[0 1 0 0 0 0 0 0 0 0] | |
[1 0 0 0 0 0 0 0 0 0]]) |
NewerOlder