Skip to content

Instantly share code, notes, and snippets.

-- The base Timer class. Useful for juicing things up generally.
-- A global instance of this called "timer" is available by default.
Timer = Object:extend()
function Timer:new()
self.timers = {}
end
-- Calls the action every frame until it's cancelled via timer:cancel.
-- The tag must be passed in otherwise there will be no way to stop this from running.
class Enemy
new: =>
draw_enemy_ui: =>
graphics.push @x, @y, 0, @spring.x, @spring.x
if @show_hp
hp_color = red[0]
if @hit_flash then hp_color = fg[0]
graphics.line @x - 0.5*@shape.w, @y - @shape.h, @x + 0.5*@shape.w, @y - @shape.h, bg[-3], 2
n = math.remap @hp, 0, @max_hp, 0, 1
class Outlier extends GameObject
new: (group, x, y, opts) =>
super group, x, y, opts
@\set_as_rectangle 18, 10, 'dynamic', 'enemy'
@\set_fixed_rotation true
@color = red[0]
@max_hp = (2000 + node.level*100)
@hp = @max_hp
@\set_as_steerable 65, 2000, 4*math.pi, 4
mixin @, Enemy
MoonScript 10 hrs █████████████▋░░░░░░░ 64.9%
Lua 3 hrs 59 mins █████▍░░░░░░░░░░░░░░░ 25.9%
Other 1 hr 25 mins █▉░░░░░░░░░░░░░░░░░░░ 9.2%
Text 0 secs ░░░░░░░░░░░░░░░░░░░░░ 0.0%
function init()
white = {1, 1, 1, 1}
black = {0, 0, 0, 1}
combine = g.newShader("combine.frag")
aesthetic = g.newShader("aesthetic.frag")
aesthetic_canvas = g.newCanvas(gw, gh)
displacement_canvas = g.newCanvas(gw, gh)
game_canvas = g.newCanvas(gw, gh)
shockwave = g.newImage("res/shockwave_displacement.png")
function init()
white = {1, 1, 1, 1}
black = {0, 0, 0, 1}
red = {1.0, 0.1, 0.2, 1}
combine = g.newShader("combine.frag")
aesthetic = g.newShader("aesthetic.frag")
aesthetic_canvas = g.newCanvas(gw, gh)
displacement_canvas = g.newCanvas(gw, gh)
game_canvas = g.newCanvas(gw, gh)
function init()
white = {1, 1, 1, 1}
black = {0, 0, 0, 1}
red = {1.0, 0.1, 0.2, 1}
combine = g.newShader("combine.frag")
aesthetic = g.newShader("aesthetic.frag")
aesthetic_canvas = g.newCanvas(gw, gh)
displacement_canvas = g.newCanvas(gw, gh)
game_canvas = g.newCanvas(gw, gh)
function init()
white = {1, 1, 1, 1}
black = {0, 0, 0, 1}
red = {1.0, 0.1, 0.2, 1}
doodle = g.newShader("doodle.frag")
doodle:send("doodle_max_offset", {0.0020, 0.0020})
doodle:send("doodle_noise_scale", {6, 8})
doodle:send("doodle_frame_count", 8)
doodle:send("doodle_frame_time", 0.2)
export class Attack
new: (@ref, @name, @ts, @tspolicy="closest") =>
@x, @y = 0, 0
@r = 0
@ttr = 0
@timer = 0
@in_range_timer = 0
@\set @name
update: (dt) =>
export class Weapon
new: (@ref, @type="sword", index=1) =>
@wx, @wy, @wz, @wr, @wsx, @wsy = 0, 0, 0, 0, 1, 1
@name = @type .. tostring(index)
if @type == "sword"
@ox, @oy = 0, 0
@r = math.pi
@r1 = Spring -math.pi/2, 100, 10
@r2 = Spring 0, 100, 10