Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working on DragonRuby Game Toolkit and RubyMotion

Amir Rajan amirrajan

💭
Working on DragonRuby Game Toolkit and RubyMotion
View GitHub Profile
@amirrajan
amirrajan / index.html
Last active Nov 5, 2022
Drag and drop from w3schools
View index.html
<!DOCTYPE HTML>
<html>
<head>
<style>
#div1 {
width: 350px;
height: 70px;
padding: 10px;
border: 1px solid #aaaaaa;
}
@amirrajan
amirrajan / main.rb
Created Oct 9, 2022
A Car That Turns - Input Function
View main.rb
class Game
attr_gtk
def input_game
return if state.scene != :game
if inputs.mouse.click && (inputs.mouse.intersect_rect? state.review_button_rect)
state.next_scene = :review
end
@amirrajan
amirrajan / demo.md
Last active Oct 30, 2022
DragonRuby Game Toolkit - Tech Demo Source Code
View demo.md
the-keeper-iteration-2.mp4
View layout-theory.org
DimensionGutter BottomGutter TopSpacer WidthCell CountCell Size
1280202042448
720525241248
0/0
0/0
@amirrajan
amirrajan / main.rb
Last active Sep 16, 2022
DragonRuby Game Toolkit - Raycasting
View main.rb
# https://github.com/BrennerLittle/DragonRubyRaycast/tree/main
$mapX = 8
$mapY = 8
$mapS = 64
$map = [
1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0, 0, 0, 0, 1,
1, 0, 1, 0, 0, 0, 0, 1,
1, 0, 1, 0, 0, 0, 0, 1,
@amirrajan
amirrajan / main.rb
Last active Jul 28, 2022
Broad Sword of Justice in DragonRuby Game Toolkit https://amirrajan.itch.io/broad-sword-of-justice
View main.rb
class Game
attr_gtk
def reset_anvils
state.anvil_phase = :idle
state.anvil_timer = 3.seconds
reset_anvil_1
reset_anvil_2
reset_anvil_3
end
@amirrajan
amirrajan / quadtree.rb
Created Jun 3, 2022
Quad tree implemented in Ruby
View quadtree.rb
class Hash
def x
self[:x]
end
def y
self[:y]
end
def w
@amirrajan
amirrajan / tmux-session-new
Created Jun 2, 2022
How to create a predefined tmux session.
View tmux-session-new
#!/bin/sh
tmux new-session\; \
split-window -h\; \
select-pane -t 1\; \
split-window -v\; \
select-pane -t 3\; \
resize-pane -L 65\; \
setw synchronize-panes\; \
send-keys 'cd ~/projects/project-1/' Enter\; \
send-keys 'reset' Enter\; \
View main.rb
def calc_camera
if player_charging?
if player_charge_percentage < 0.2
state.camera.trauma += 0.005
elsif player_charge_percentage < 0.5
state.camera.trauma += 0.01
elsif player_charge_percentage < 0.8
state.camera.trauma += 0.02
else
state.camera.trauma += 0.04
@amirrajan
amirrajan / main.rb
Last active Apr 25, 2022
DragonRuby Game Toolkit Boss Battle Sample App
View main.rb
class Game
attr_gtk
def tick
defaults
input
calc
render
end