diff options
| l--------- | app/dragonruby | 1 | ||||
| -rw-r--r-- | app/main.rb | 4 | ||||
| -rw-r--r-- | app/sprites.rb | 28 |
3 files changed, 33 insertions, 0 deletions
diff --git a/app/dragonruby b/app/dragonruby new file mode 120000 index 0000000..2e5d301 --- /dev/null +++ b/app/dragonruby @@ -0,0 +1 @@ +/home/tradam/Documents/Ruby/dragon/dragonruby-linux-amd64/dragonruby
\ No newline at end of file diff --git a/app/main.rb b/app/main.rb index 0ebdc6b..d797a3e 100644 --- a/app/main.rb +++ b/app/main.rb @@ -1,6 +1,10 @@ +require 'app/sprites.rb' def tick args args.outputs.labels << [640, 500, 'Hello World!', 5, 1] args.outputs.labels << [640, 460, 'Go to docs/docs.html and read it!', 5, 1] args.outputs.labels << [640, 420, 'Join the Discord! http://discord.dragonruby.org', 5, 1] args.outputs.sprites << [576, 280, 128, 101, 'dragonruby.png'] + @render = Sprite.objects[1] if args.inputs.keyboard.key_held.a + @render = Sprite.objects[0] if args.inputs.keyboard.key_held.s + args.outputs.sprites << @render end diff --git a/app/sprites.rb b/app/sprites.rb new file mode 100644 index 0000000..0016436 --- /dev/null +++ b/app/sprites.rb @@ -0,0 +1,28 @@ +class Sprite + class <<self + attr_reader :objects + end + @objects = [] + @objects << { + x: 100, + y: 100, + w: 48, + h: 96, + path: 'sprites/non-free/Modern_Interiors/test.png', + source_x: 0, + source_y: 288, + source_w: 48, + source_h: 96 + } + @objects << { + x: 100, + y: 100, + w: 48, + h: 96, + path: 'sprites/non-free/Modern_Interiors/test.png', + source_x: 48, + source_y: 288, + source_w: 48, + source_h: 96 + } +end |
