From 5f9ad4e95625e1152bd0ad8bda1a460b696a7d13 Mon Sep 17 00:00:00 2001 From: realtradam Date: Tue, 19 Jan 2021 19:33:31 -0500 Subject: cleanup --- README.md | 11 +++++++++++ animator.rb | 1 - assets/background.png | Bin 0 -> 29939 bytes assets/player.png | Bin 0 -> 1044 bytes background.png | Bin 29939 -> 0 bytes player.png | Bin 1044 -> 0 bytes run.rb | 4 ++-- 7 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 assets/background.png create mode 100644 assets/player.png delete mode 100644 background.png delete mode 100644 player.png diff --git a/README.md b/README.md new file mode 100644 index 0000000..31a4f2a --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Ruby2D Camera Demo + +I wanted to make a proof of concept to see how feasible it is to implement a camera system in Ruby2D. Turns out it is very feasible :D + +How it works: + +A single `Camera` class exists which keeps track of most objects that exists. Whenever you want the camera to move it simply move the entire game world. +If you want to use this little demo in your own projects feel free to do so! All you need is the camera.rb file and then just `require` or `require_relative` it into your project. +See the code as an example for how it is used. + +Credit is appreciated but not required :) diff --git a/animator.rb b/animator.rb index 4a94a87..c2640f6 100644 --- a/animator.rb +++ b/animator.rb @@ -37,6 +37,5 @@ class AnimatedSquare @speed = -@speed end end - puts offset end end diff --git a/assets/background.png b/assets/background.png new file mode 100644 index 0000000..e12baab Binary files /dev/null and b/assets/background.png differ diff --git a/assets/player.png b/assets/player.png new file mode 100644 index 0000000..485e972 Binary files /dev/null and b/assets/player.png differ diff --git a/background.png b/background.png deleted file mode 100644 index e12baab..0000000 Binary files a/background.png and /dev/null differ diff --git a/player.png b/player.png deleted file mode 100644 index 485e972..0000000 Binary files a/player.png and /dev/null differ diff --git a/run.rb b/run.rb index 66827ee..7ebb914 100644 --- a/run.rb +++ b/run.rb @@ -2,8 +2,8 @@ require 'ruby2d' require_relative 'camera' require_relative 'animator' -@background = Image.new('background.png') -@player = Image.new('player.png') +@background = Image.new('assets/background.png') +@player = Image.new('assets/player.png') @squares = [] # There is 2 ways you can add objects to be known and controlled by the camera, both do the same thing -- cgit v1.2.3