diff options
| author | realtradam <[email protected]> | 2021-01-19 19:33:31 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-01-19 19:33:31 -0500 |
| commit | 5f9ad4e95625e1152bd0ad8bda1a460b696a7d13 (patch) | |
| tree | 77347054fc0bb51649a9d1c49720f8f55e87cffa | |
| parent | 344daa131d2343283e9e33e454b328f3e233f6b4 (diff) | |
| download | ruby2d-camera-5f9ad4e95625e1152bd0ad8bda1a460b696a7d13.tar.gz ruby2d-camera-5f9ad4e95625e1152bd0ad8bda1a460b696a7d13.zip | |
cleanup
| -rw-r--r-- | README.md | 11 | ||||
| -rw-r--r-- | animator.rb | 1 | ||||
| -rw-r--r-- | assets/background.png (renamed from background.png) | bin | 29939 -> 29939 bytes | |||
| -rw-r--r-- | assets/player.png (renamed from player.png) | bin | 1044 -> 1044 bytes | |||
| -rw-r--r-- | run.rb | 4 |
5 files changed, 13 insertions, 3 deletions
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/background.png b/assets/background.png Binary files differindex e12baab..e12baab 100644 --- a/background.png +++ b/assets/background.png diff --git a/player.png b/assets/player.png Binary files differindex 485e972..485e972 100644 --- a/player.png +++ b/assets/player.png @@ -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 |
