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 / readme.md
Last active July 16, 2024 01:26
Minimal Emacs configuration for Windows and Mac (Vim bindings and leader key)

Here is a minimal setup that works on Windows and Mac (yes I use Emacs on Windows and it works well).

;; using an editor you are comfortable with
;; create c:/Users/USERNAME/AppData/Roaming/.emacs.d/init.el
;; and paste these contents in there:

;; NOTE: depending on how you start up emacs, your home directory may
;;       be different than the one above. Your initialization file 
;;       needs to be saved at ~/.emacs.d/init.el (however that is mapped
@amirrajan
amirrajan / player.rb
Last active July 2, 2024 21:46
DragonRuby Game Toolkit - Player State Machine
class Player
attr :x, :y, :w, :h, :action, :action_at,
:dx, :dy, :breathe_at, :facing, :run_speed, :on_ground_y, :on_ground,
:prev_on_ground
def initialize
@breathe_at = -100
@action = :idle
@action_at = 0
@x = 100
@amirrajan
amirrajan / main.rb
Last active June 25, 2024 21:01
DragonRuby Game Toolkit - Rhythm Based Game
def tick args
defaults args
tick_audio args
tick_calibration args
if args.state.tick_count > args.state.start_playing_on_tick
args.state.beat_accumulator += args.state.beats_per_tick
args.state.quarter_beat = args.state.beat_accumulator.to_i
args.state.previous_quarter_beat ||= args.state.quarter_beat
end
@amirrajan
amirrajan / 00_demo.md
Last active June 25, 2024 16:09
mRuby vs Lua as a Scripting Layer in a Game Engine
enemy-encounter.mp4
@amirrajan
amirrajan / main.rb
Created June 22, 2024 16:06
The Ensign - Mind Games source
class MindGames
attr_accessor :message_history, :message
def initialize game
@game = game
@message = ""
@message_history = []
@random_tips = []
end
@amirrajan
amirrajan / demo.md
Last active June 12, 2024 04:07
DragonRuby Game Toolkit - Move Camera With Mouse
demo.mp4
@amirrajan
amirrajan / main.rb
Created May 28, 2024 20:58
DragonRuby Game Toolkit - Scene Management With Fade To Black
class RootScene < Scene
attr :game
def initialize
@game = Game.new
$game = @game
@world_scene = WorldScene.new
@embark_scene = EmbarkScene.new
@world_event_scene = WorldEventScene.new
@battle_scene = BattleScene.new
@amirrajan
amirrajan / main.rb
Last active May 16, 2024 15:30
DragonRuby Game Toolkit - Bunnymark - https://youtu.be/E_f7UkznMjY
class Rabbit
def initialize x, y, w, h
@x = x
@dx = [1, -1].sample
@y = y
@dy = [1, -1].sample
@w = w
@h = h
@amirrajan
amirrajan / 00.md
Last active April 15, 2024 05:35
Flappy Bird - DragonRuby Game Toolkit: Apples to Apples
apples-to-apples.mp4
nani.mp4