Skip to content

Instantly share code, notes, and snippets.

View amirrajan's full-sized avatar
💭
Working on DragonRuby Game Toolkit and RubyMotion

Amir Rajan amirrajan

💭
Working on DragonRuby Game Toolkit and RubyMotion
View GitHub Profile
@amirrajan
amirrajan / main.rb
Last active July 22, 2025 23:31
DragonRuby Game Toolkit - I Have A Jet Pack (https://amirrajan.itch.io/i-have-a-jetpack)
class Game
attr :args
def tick
defaults
current_scene = state.scene
calc
render
state.clock += 1
if current_scene != state.scene
@amirrajan
amirrajan / main.rb
Last active July 9, 2025 19:48
DragonRuby Game Toolkit - check boxes with save and load
def boot args
# initialize args.state to an empty hash on boot
args.state = {}
end
def tick args
defaults args
calc args
render args
end
@amirrajan
amirrajan / he-who-fights-with-monsters.org
Last active July 8, 2025 04:41
He Who Fights With Monsters

Jason’s Essence Abilities.

The following is a list of Jason’s essence abilities as of gold rank. The list is written for brevity (believe it or not) rather than accuracy or comprehensiveness.

Dark Essence

Path of Shadows (special ability)

Iron: Teleport through a shadow to another visible shadow.

Bronze: Create portals across regional distances.

Silver: Create portals across continental distances.

@amirrajan
amirrajan / main.cs
Last active June 30, 2025 22:29
C# method missing
public class Person : Gemini
{
//define a method called MethodMissing taking in one parameter
dynamic MethodMissing(dynamic callInfo)
{
//check to see if the method being called ends in Html
if(callInfo.Name.EndsWith("Html"))
{
//if it does, add a method on the fly that returns
//the html encoded version of the parsed property
@amirrajan
amirrajan / main.rb
Last active June 29, 2025 19:41
DragonRuby Game Toolkit - Hooke's Law, Coulomb's Law
def boot args
args.state = {}
end
def tick args
args.state.center_screen ||= { x: 640, y: 360 }
args.state.particles ||= [
{ x: 300,
y: 300,
w: 16,
@amirrajan
amirrajan / main.rb
Created June 29, 2025 03:16
DragonRuby Game Toolkit Cooking Game
class Game
attr_gtk
def initialize
@ingredients_in_hand = []
@available_ingredients = [
:flour,
:baking_soda,
:sugar,
:flour,
@amirrajan
amirrajan / main.rb
Created June 20, 2025 22:30
DragonRuby Game Toolkit Moving Walls
class Game
attr_gtk
def initialize
@dvd = {
x: 640,
y: 360,
w: 64,
h: 64,
dx: 5,
@amirrajan
amirrajan / main.rb
Created June 18, 2025 06:41
DragonRuby Game Toolkit - Fifteen Puzzle Game version 2.0
class Game
attr_gtk
def initialize
# rng is sent to Random so that everyone gets the same levels
@rng = Random.new 100
@solved_board = (1..16).to_a
# rendering size of the cell
def tick args
if Kernel.tick_count > 518
puts "#{args.state.dvd}"
GTK.slowmo! 30
end
args.state.dvd ||= { x: 640,
y: 360,
w: 64,
h: 64,
@amirrajan
amirrajan / shared_controller.rb
Created June 7, 2025 00:05
two controllers, one game
class SharedKeyDown
attr :args
def inputs
@args.inputs
end
def start
inputs.controllers.any? { |c| c.key_down.start }
end