Skip to content

Instantly share code, notes, and snippets.

View sprite-guard's full-sized avatar

Sprite sprite-guard

View GitHub Profile
require "app/continuebox.rb"
class StoryBox
# descriptor format:
# StoryBox.new({
# body: {x: 310, y: 230, w: 60, h: 7, font: "font/euler.otf"},
# name: {x: 310, y: 280, font: "font/euler.otf"}
# })
# body has the font, x and y coordinates of the text box,
class ContinueBox
attr_accessor :x, :y, :w, :h, :text, :lines, :page, :line_height
def initialize box, font=nil
@x = box.x
@y = box.y
# W and H are in characters, not pixels
# Make sure the H you set leaves room for the "..." at the bottom
@w = box.w
class Array
def each_onto_all &block
self.each_index do |i|
self.each_index do |j|
if(i != j)
yield(self.at(i), self.at(j))
end
end
end
end
@sprite-guard
sprite-guard / printable ascii horizontal.txt
Created April 13, 2021 20:24
Printable ASCII characters written out horizontally for easier copying
22222222222222223333333333333333444444444444444455555555555555556666666666666666777777777777777
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDE
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
facts:
<>Warbride enemies Yarrow
<>Yarrow enemies GoldenYarrow
<>GoldenYarrow allies YellowClay
YellowClay enemies SouthernAlliance
WhiteShale member SouthernAlliance
IronBrick member SouthernAlliance
GodGiven member SouthernAlliance
<>NorthernKingdoms allies Yarrow
<>FoothillTribes allies YellowClay
def tick args
if(args.state.tick_count == 0)
args.state.debug_messages = []
end
if(args.state.tick_count % 5 == 0)
debug_log args, ("working: " + args.state.tick_count.to_s)
end
debug_display args
end
@sprite-guard
sprite-guard / main.rb
Created February 29, 2020 23:36
Moving bezier curves with gaps
# The text from the gist has been loaded.
# Click the Run game! button to execute the code.
# http://fiddle.dragonruby.org?share=https://gist.github.com/amirrajan/2f63f4d2fc97a81b087e6b4e6bd5bd92
def tick args
xa = 100 + ((args.state.tick_count) % 300)
xb = 550 + ((args.state.tick_count/2) % 357)
xc = 440 + ((args.state.tick_count) % 413)
xd = 1000 - ((args.state.tick_count / 3) % 988)