Skip to content

Instantly share code, notes, and snippets.

View Eric-Guo's full-sized avatar

Eric Guo Eric-Guo

View GitHub Profile
@Eric-Guo
Eric-Guo / a_noble_circle_stage.rb
Created June 18, 2021 00:43 — forked from amirrajan/a_noble_circle_stage.rb
Ruby DSL for one of my platformers
# coding: utf-8
module Women
def women
{
display_name: '≈≈≈ Women ≈≈≈',
checkpoint: :women,
stage: [
'Unfortunately for Circle, he was cursed with many, many, sides.',
page_66,
{ loc: ' x ', type: Triangle },
@Eric-Guo
Eric-Guo / main.rb
Created June 5, 2021 22:29 — forked from icculus/main.rb
Tetris in DragonRuby, code at the end of Part 1
# This is the code as it stands at the end of
# "Let's make Tetris with DragonRuby Game Toolkit!" Part 1:
# https://www.youtube.com/watch?v=xZMwRSbC4rY
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_move = 30
@Eric-Guo
Eric-Guo / main.rb
Created June 3, 2021 23:49 — forked from amirrajan/main.rb
Gauntlet written in DragonRuby Game Toolkit
class Game
attr_gtk
def tick
defaults
render
input
calc
end
@Eric-Guo
Eric-Guo / main.rb
Created June 3, 2021 09:39
short effect
https://twitter.com/_mdymkowski/status/1371476003789361153
def tick a
B=a.outputs[:r].solids<<[A=0,0,1e2,1e4,F=255,F,F]
a.solids<<[0,0,2e3,1e3,0,0,0]
a.sprites<<http://960.map{[638,360,w=($i+=3).sin*F*1.5,h=$i.sin*F,:r,A+=3,5,F*w,-F*(w+h),-F*h]};
$i+=1;
end
@Eric-Guo
Eric-Guo / ext.c
Created May 31, 2021 23:37 — forked from oeloeloel/ext.c
DragonRuby Pixel Arrays with C Extensions. Quick and Dirty example.
/*
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
@Eric-Guo
Eric-Guo / main.rb
Created May 30, 2021 08:50 — forked from sprite-guard/main.rb
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)
@Eric-Guo
Eric-Guo / RAYS.rb
Created May 30, 2021 08:49
RAYS and detections.
RAYS = 128
SPLIT = 8
RAYSPERPASS = 4
CLEAR = 60
DRAW_RAYS = true
MAX = 500
ACCURACY = 2 # Accepts numbers 1 or 2. For some reason 3 or greater crashes? Lower is more accurate, but slower
DEGREES_TO_RADIANS = Math::PI / 180
@Eric-Guo
Eric-Guo / basicgorillas.rb
Created May 28, 2021 13:19 — forked from icculus/basicgorillas.rb
DragonRuby Basic Gorillas
# This is the complete source code to Basic Gorillas:
# https://dragonruby.itch.io/basicgorillas
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class YouSoBasicGorillas
attr_accessor :outputs, :grid, :game, :inputs
@Eric-Guo
Eric-Guo / main.rb
Last active May 23, 2021 00:47 — forked from jschoolcraft/main.rb
Coin Toss
$gtk.reset
class Button
attr_accessor :label
def initialize(x, y, h, w, label)
@x = x
@y = y
@h = h
@w = w
@label = label
@Eric-Guo
Eric-Guo / private.xml
Last active April 28, 2021 00:51 — forked from pjan/private.xml
Karabiner private.xml for Topre REALFORCE 87U on rMBP
<?xml version="1.0"?>
<root>
<item>
<name>For Topre REALFORCE 87u Users</name>
<devicevendordef>
<vendorname>TopreCorporation</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<item>
<name>Fix FN + F1..F12 and functional keys</name>