dragonruby-parallax

a simple parallax made with dragon-ruby
git clone https://github.com/TanguyAndreani/dragonruby-parallax
Log | Files | Refs | README

commit 8b847456ef4d2b89499a7acb28f95b03f2fea43e
Author: Tanguy Andreani <tanguy.andreani@tuta.io>
Date:   Sun, 23 Feb 2020 21:01:16 +0100

first commit

Diffstat:
A.gitignore | 2++
AREADME.md | 14++++++++++++++
Aapp/main.rb | 19+++++++++++++++++++
Aassets/layer1.png | 0
Aassets/layer2.png | 0
Aassets/layer3.png | 0
Aassets/layer4.png | 0
Aassets/layer5.png | 0
Arun | 3+++
Ascreencast.gif | 0
10 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +*.mkv+ \ No newline at end of file diff --git a/README.md b/README.md @@ -0,0 +1,13 @@ +# A simple parallax with DragonRuby + +So this is my first try at DragonRuby. I tried to make a parallax, which +I already did for a game with CSFML. + +![](./screencast.gif) + +*Sorry for the recording quality. The parallax looks way better than that.* + +## Images + +They were found randomly on the web, they were free to use but I think +they need to be in the credits.+ \ No newline at end of file diff --git a/app/main.rb b/app/main.rb @@ -0,0 +1,18 @@ +def layers + [ + 'layer1.png', + 'layer2.png', + 'layer3.png', + 'layer4.png', + 'layer5.png', + ].map { |s| "assets/#{s}" } +end + +def tick args + layers.each_with_index do |f, i| + i += 1 + t = args.state.tick_count % (1280 / i) + args.outputs.sprites << [t * -1 * i, 0, 1280, 720, f] + args.outputs.sprites << [1278 + t * -1 * i, 0, 1280, 720, f] + end +end+ \ No newline at end of file diff --git a/assets/layer1.png b/assets/layer1.png Binary files differ. diff --git a/assets/layer2.png b/assets/layer2.png Binary files differ. diff --git a/assets/layer3.png b/assets/layer3.png Binary files differ. diff --git a/assets/layer4.png b/assets/layer4.png Binary files differ. diff --git a/assets/layer5.png b/assets/layer5.png Binary files differ. diff --git a/run b/run @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +dragonruby .+ \ No newline at end of file diff --git a/screencast.gif b/screencast.gif Binary files differ.