This file contains 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
$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 |
This file contains 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
# 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 |
This file contains 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
$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) |
This file contains 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
# 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 |
This file contains 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
# Bresenham circle for DragonRuby (basic) | |
RED = [255, 0, 0] | |
def put_pixel(args, x, y, c) | |
args.outputs.solids << [x, y, 1, 1, *c] | |
end | |
def drawCircle(args, xc, yc, x, y) | |
put_pixel(args, xc + x, yc + y, RED) |
This file contains 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
/* | |
DragonRuby C Extension Pixel Array | |
Written by @Akzidenz-Grotesk (with help from @AlexDenisov & @Kenneth | CANICVS) | |
Demonstrates some quick and pretty dirty image filters | |
Loads image files into Pixel Array | |
Performs image manipulation every tick | |
Returns a modified 100x100 pixel image to DragonRuby | |
*/ | |
#ifndef NULL |
This file contains 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
$gtk.reset | |
def tick args | |
defaults args | |
handle_input args | |
calc args | |
render args | |
end | |
def handle_input args |
This file contains 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
# cromakey no chromakey | |
# removes a specified background colour from a spritesheet | |
# by making it transparent and exports it as a new file. | |
# change these values then run in DragonRuby | |
# path to spritesheet | |
INPUT_FILE = '/sprites/chroma-test-input.png' | |
# path to export file | |
OUTPUT_FILE = '/sprites/chroma-test-output.png' |
This file contains 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
# supersampling for fancy sprite rotation | |
# solves uneven rotation of odd-sized sprites | |
# using an upscaled render target | |
def tick(args) | |
args.state.size ||= 7 # width/height of sprite (odd) | |
args.state.upsample ||= 8 # 2 minimum, 8 is better | |
args.state.path ||= 'sprites/rotate5.png' # path to sprite | |
args.state.upsample_size ||= args.state.size * args.state.upsample |
This file contains 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
class AnObject | |
attr_reader :a, :b, :c, :d, :e, :f | |
def initialize | |
@a = 1 | |
@b = 1 | |
@c = 1 | |
@d = 1 | |
@e = 1 | |
@f = 1 | |
end |
OlderNewer