Skip to content

Instantly share code, notes, and snippets.

@oeloeloel
oeloeloel / main.rb
Created October 1, 2020 15:12
TeenyTiny DragonRuby MiniGameJam SimpleSample
# TeenyTiny DragonRuby MiniGameJam SimpleSample
# This is a simple sample game that takes 20 seconds to win.
SMALL_SHAPE_SIZE = 200
LARGE_SHAPE_SIZE = 300
VIEW_WIDTH = $args.grid.w
VIEW_HEIGHT = $args.grid.h
H_CENTRE = VIEW_WIDTH / 2
V_CENTRE = VIEW_HEIGHT / 2
WIN_SCORE = 10
@oeloeloel
oeloeloel / main.rb
Last active September 17, 2020 19:04
[DragonRuby] Recycle Symbols for Render Targets (general idea)
$gtk.reset
def tick args
args.state.rt_symbols_recycle_bin = []
args.state.rt_symbol_counter = 0
if args.state.tick_count == 0
# get a couple of fresh symbols
symbol1 = get_rt_symbol(args)
@oeloeloel
oeloeloel / main.rb
Created September 12, 2020 14:28
Bresenham's Line Algorithm in DragonRuby
# brief demonstration of Bresenham's line algorithm in DragonRuby
BRUSH_SIZE = 16
def tick(args)
args.state.last_mouse_x ||= args.inputs.mouse.x
args.state.last_mouse_y ||= args.inputs.mouse.y
# set the start of the line
x0 = args.state.last_mouse_x
$gtk.reset seed: Time.now.to_i
#puts "++++++++++++++++++ RESET +++++++++++++++++++++"
=begin
Creates a few different effects using particles
explode: fly apart dramatically and burn with flaming colours
melt: fall apart in a downward direction while turning toxic green
disintegrate: break apart less dramatically without burning colours