diff options
| author | realtradam <[email protected]> | 2021-04-24 13:57:31 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-04-24 13:57:31 -0400 |
| commit | 8968999c513b4ce3cac9f5907199235006bb6a11 (patch) | |
| tree | b132cf991ff09a7a1fe74a3899be253c704ec84d | |
| parent | 645974e42ce72c95a3ba9f9de2278e71d89ffa6c (diff) | |
| download | ruby2d-camera-8968999c513b4ce3cac9f5907199235006bb6a11.tar.gz ruby2d-camera-8968999c513b4ce3cac9f5907199235006bb6a11.zip | |
.
29 files changed, 598 insertions, 48 deletions
diff --git a/assets/blobdanceextract/blob1.png b/assets/blobdanceextract/blob1.png Binary files differnew file mode 100644 index 0000000..53cb756 --- /dev/null +++ b/assets/blobdanceextract/blob1.png diff --git a/assets/blobdanceextract/blob10.png b/assets/blobdanceextract/blob10.png Binary files differnew file mode 100644 index 0000000..2641d19 --- /dev/null +++ b/assets/blobdanceextract/blob10.png diff --git a/assets/blobdanceextract/blob11.png b/assets/blobdanceextract/blob11.png Binary files differnew file mode 100644 index 0000000..da8f7a9 --- /dev/null +++ b/assets/blobdanceextract/blob11.png diff --git a/assets/blobdanceextract/blob12.png b/assets/blobdanceextract/blob12.png Binary files differnew file mode 100644 index 0000000..fe2ca88 --- /dev/null +++ b/assets/blobdanceextract/blob12.png diff --git a/assets/blobdanceextract/blob13.png b/assets/blobdanceextract/blob13.png Binary files differnew file mode 100644 index 0000000..6368c56 --- /dev/null +++ b/assets/blobdanceextract/blob13.png diff --git a/assets/blobdanceextract/blob14.png b/assets/blobdanceextract/blob14.png Binary files differnew file mode 100644 index 0000000..a3457d9 --- /dev/null +++ b/assets/blobdanceextract/blob14.png diff --git a/assets/blobdanceextract/blob15.png b/assets/blobdanceextract/blob15.png Binary files differnew file mode 100644 index 0000000..fc1be85 --- /dev/null +++ b/assets/blobdanceextract/blob15.png diff --git a/assets/blobdanceextract/blob16.png b/assets/blobdanceextract/blob16.png Binary files differnew file mode 100644 index 0000000..a12d60c --- /dev/null +++ b/assets/blobdanceextract/blob16.png diff --git a/assets/blobdanceextract/blob17.png b/assets/blobdanceextract/blob17.png Binary files differnew file mode 100644 index 0000000..cdb2569 --- /dev/null +++ b/assets/blobdanceextract/blob17.png diff --git a/assets/blobdanceextract/blob18.png b/assets/blobdanceextract/blob18.png Binary files differnew file mode 100644 index 0000000..bcc0bad --- /dev/null +++ b/assets/blobdanceextract/blob18.png diff --git a/assets/blobdanceextract/blob19.png b/assets/blobdanceextract/blob19.png Binary files differnew file mode 100644 index 0000000..128fbb6 --- /dev/null +++ b/assets/blobdanceextract/blob19.png diff --git a/assets/blobdanceextract/blob2.png b/assets/blobdanceextract/blob2.png Binary files differnew file mode 100644 index 0000000..421ef41 --- /dev/null +++ b/assets/blobdanceextract/blob2.png diff --git a/assets/blobdanceextract/blob20.png b/assets/blobdanceextract/blob20.png Binary files differnew file mode 100644 index 0000000..4ed12cf --- /dev/null +++ b/assets/blobdanceextract/blob20.png diff --git a/assets/blobdanceextract/blob3.png b/assets/blobdanceextract/blob3.png Binary files differnew file mode 100644 index 0000000..f7cf2f3 --- /dev/null +++ b/assets/blobdanceextract/blob3.png diff --git a/assets/blobdanceextract/blob4.png b/assets/blobdanceextract/blob4.png Binary files differnew file mode 100644 index 0000000..aff67c8 --- /dev/null +++ b/assets/blobdanceextract/blob4.png diff --git a/assets/blobdanceextract/blob5.png b/assets/blobdanceextract/blob5.png Binary files differnew file mode 100644 index 0000000..1955c91 --- /dev/null +++ b/assets/blobdanceextract/blob5.png diff --git a/assets/blobdanceextract/blob6.png b/assets/blobdanceextract/blob6.png Binary files differnew file mode 100644 index 0000000..ffd08f2 --- /dev/null +++ b/assets/blobdanceextract/blob6.png diff --git a/assets/blobdanceextract/blob7.png b/assets/blobdanceextract/blob7.png Binary files differnew file mode 100644 index 0000000..f6cdb40 --- /dev/null +++ b/assets/blobdanceextract/blob7.png diff --git a/assets/blobdanceextract/blob8.png b/assets/blobdanceextract/blob8.png Binary files differnew file mode 100644 index 0000000..e787bf4 --- /dev/null +++ b/assets/blobdanceextract/blob8.png diff --git a/assets/blobdanceextract/blob9.png b/assets/blobdanceextract/blob9.png Binary files differnew file mode 100644 index 0000000..ec097a0 --- /dev/null +++ b/assets/blobdanceextract/blob9.png diff --git a/assets/sprites/blob.png b/assets/sprites/blob.png Binary files differnew file mode 100644 index 0000000..6326ec0 --- /dev/null +++ b/assets/sprites/blob.png diff --git a/lib/camera/camera.rb b/lib/camera/camera.rb index e5fd254..cfea114 100644 --- a/lib/camera/camera.rb +++ b/lib/camera/camera.rb @@ -36,9 +36,10 @@ module Camera case item when Triangle item.extend Camera::TriangleWrapped - puts item.class when Square item.extend Camera::SquareWrapped + when Rectangle + item.extend Camera::RectangleWrapped when Quad item.extend Camera::QuadWrapped when Line @@ -53,7 +54,7 @@ module Camera item.extend Camera::TextWrapped else puts 'Warning: Non-standard Object added to Camera' - puts 'Object may not behave as expected' + puts ' Object may not behave as expected' end objects.push(item) unless objects.include?(item) end diff --git a/lib/camera/wrappers/circle_wrapper.rb b/lib/camera/wrappers/circle_wrapper.rb new file mode 100644 index 0000000..bd4f54a --- /dev/null +++ b/lib/camera/wrappers/circle_wrapper.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Camera +# Wraps existing variables as well as adding new methods +# so that it can be handled by the Camera Module + module CircleWrapped + # Recalculates real coordiantes + # Use after changing variables + def update + angle = Camera.angle * (Math::PI / 180) + half_width = Window.width * 0.5 + half_height = Window.height * 0.5 + @x = (((x - Camera.x) * Math.cos(angle)) - ((y - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y = (((x - Camera.x) * Math.sin(angle)) + ((y - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @radius = radius * Camera.zoom + end + + # Methods for moving the shape as well as + # wrappers for the coordinates so that + # they are handled by the Camera instead + # and for ease of programming + def x + @virtual_x ||= @x + end + + def x=(x) + @virtual_x = x + end + + def y + @virtual_y ||= @y + end + + def y=(y) + @virtual_y = y + end + + def radius + @virtual_radius ||= @radius + end + + def radius=(radius) + @virtual_radius = radius + end + end +end + diff --git a/lib/camera/wrappers/line_wrapper.rb b/lib/camera/wrappers/line_wrapper.rb new file mode 100644 index 0000000..4024d1f --- /dev/null +++ b/lib/camera/wrappers/line_wrapper.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +module Camera +# Wraps existing variables as well as adding new methods +# so that it can be handled by the Camera Module + module LineWrapped + # Recalculates real coordiantes + # Use after changing variables + def update + angle = Camera.angle * (Math::PI / 180) + half_width = Window.width * 0.5 + half_height = Window.height * 0.5 + @x1 = (((x + x1 - Camera.x) * Math.cos(angle)) - ((y + y1 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y1 = (((x + x1 - Camera.x) * Math.sin(angle)) + ((y + y1 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x2 = (((x + x2 - Camera.x) * Math.cos(angle)) - ((y + y2 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y2 = (((x + x2 - Camera.x) * Math.sin(angle)) + ((y + y2 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @width = width * Camera.zoom + end + + #Methods for moving the shape + def x + @x ||= x1 + end + + def x=(x) + @x = x + end + + def y + @y ||= y1 + end + + def y=(y) + @y = y + end + + # Wrappers for the coordinates so that + # they are handled by the Camera instead + # and for ease of programming + def x1 + @virtual_x1 ||= @x1 + end + + def x1=(x1) + @virtual_x1 = x1 + end + + def y1 + @virtual_y1 ||= @y1 + end + + def y1=(y1) + @virtual_y1 = y1 + end + + def x2 + @virtual_x2 ||= @x2 + end + + def x2=(x2) + @virtual_x2 = x2 + end + + def y2 + @virtual_y2 ||= @y2 + end + + def y2=(y2) + @virtual_y2 = y2 + end + + def width + @virtual_width ||= @width + end + + def width=(width) + @virtual_width = width + end + + def length + points_distance(x1, y1, x2, y2) + end + + def contains?(x, y) + points_distance(x1, y1, x, y) <= length && + points_distance(x2, y2, x, y) <= length && + (((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1).abs / length) <= 0.5 * width + end + end +end + diff --git a/lib/camera/wrappers/quad_wrapper.rb b/lib/camera/wrappers/quad_wrapper.rb new file mode 100644 index 0000000..19d6166 --- /dev/null +++ b/lib/camera/wrappers/quad_wrapper.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module Camera +# Wraps existing variables as well as adding new methods +# so that it can be handled by the Camera Module + module QuadWrapped + # Recalculates real coordiantes + # Use after changing variables + def update + angle = Camera.angle * (Math::PI / 180) + half_width = Window.width * 0.5 + half_height = Window.height * 0.5 + @x1 = (((x + x1 - Camera.x) * Math.cos(angle)) - ((y + y1 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y1 = (((x + x1 - Camera.x) * Math.sin(angle)) + ((y + y1 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x2 = (((x + x2 - Camera.x) * Math.cos(angle)) - ((y + y2 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y2 = (((x + x2 - Camera.x) * Math.sin(angle)) + ((y + y2 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x3 = (((x + x3 - Camera.x) * Math.cos(angle)) - ((y + y3 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y3 = (((x + x3 - Camera.x) * Math.sin(angle)) + ((y + y3 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x4 = (((x + x4 - Camera.x) * Math.cos(angle)) - ((y + y4 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y4 = (((x + x4 - Camera.x) * Math.sin(angle)) + ((y + y4 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + end + + #Methods for moving the shape + def x + @x ||= x1 + end + + def x=(x) + @x = x + end + + def y + @y ||= y1 + end + + def y=(y) + @y = y + end + + # Wrappers for the coordinates so that + # they are handled by the Camera instead + # and for ease of programming + def x1 + @virtual_x1 ||= @x1 + end + + def x1=(x1) + @virtual_x1 = x1 + end + + def y1 + @virtual_y1 ||= @y1 + end + + def y1=(y1) + @virtual_y1 = y1 + end + + def x2 + @virtual_x2 ||= @x2 + end + + def x2=(x2) + @virtual_x2 = x2 + end + + def y2 + @virtual_y2 ||= @y2 + end + + def y2=(y2) + @virtual_y2 = y2 + end + + def x3 + @virtual_x3 ||= @x3 + end + + def x3=(x3) + @virtual_x3 = x3 + end + + def y3 + @virtual_y3 ||= @y3 + end + + def y3=(y3) + @virtual_y3 = y3 + end + def x4 + @virtual_x3 ||= @x3 + end + + def x4=(x4) + @virtual_x4 = x4 + end + + def y4 + @virtual_y4 ||= @y4 + end + + def y4=(y4) + @virtual_y4 = y4 + end + end +end + diff --git a/lib/camera/wrappers/rectangle_wrapper.rb b/lib/camera/wrappers/rectangle_wrapper.rb new file mode 100644 index 0000000..51836db --- /dev/null +++ b/lib/camera/wrappers/rectangle_wrapper.rb @@ -0,0 +1,129 @@ +# frozen_string_literal: true + +module Camera +# Wraps existing variables as well as adding new methods +# so that it can be handled by the Camera Module + module RectangleWrapped + # Recalculates real coordiantes + # Use after changing variables + def update + angle = Camera.angle * (Math::PI / 180) + half_width = Window.width * 0.5 + half_height = Window.height * 0.5 + @x1 = (((x + x1 - Camera.x) * Math.cos(angle)) - ((y + y1 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y1 = (((x + x1 - Camera.x) * Math.sin(angle)) + ((y + y1 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x2 = (((x + x2 - Camera.x) * Math.cos(angle)) - ((y + y2 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y2 = (((x + x2 - Camera.x) * Math.sin(angle)) + ((y + y2 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x3 = (((x + x3 - Camera.x) * Math.cos(angle)) - ((y + y3 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y3 = (((x + x3 - Camera.x) * Math.sin(angle)) + ((y + y3 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x4 = (((x + x4 - Camera.x) * Math.cos(angle)) - ((y + y4 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y4 = (((x + x4 - Camera.x) * Math.sin(angle)) + ((y + y4 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + end + + #Methods for moving the shape + def x + @x ||= x1 + end + + def x=(x) + @x = x + end + + def y + @y ||= y1 + end + + def y=(y) + @y = y + end + + # Wrappers for the coordinates so that + # they are handled by the Camera instead + # and for ease of programming + def x1 + @virtual_x1 ||= @x1 + end + + def x1=(x1) + @virtual_x1 = x1 + end + + def y1 + @virtual_y1 ||= @y1 + end + + def y1=(y1) + @virtual_y1 = y1 + end + + def x2 + @virtual_x2 ||= @x2 + end + + def x2=(x2) + @virtual_x2 = x2 + end + + def y2 + @virtual_y2 ||= @y2 + end + + def y2=(y2) + @virtual_y2 = y2 + end + + def x3 + @virtual_x3 ||= @x3 + end + + def x3=(x3) + @virtual_x3 = x3 + end + + def y3 + @virtual_y3 ||= @y3 + end + + def y3=(y3) + @virtual_y3 = y3 + end + + def x4 + @virtual_x4 ||= @x4 + end + + def x4=(x4) + @virtual_x4 = x4 + end + + def y4 + @virtual_y4 ||= @y4 + end + + def y4=(y4) + @virtual_y4 = y4 + end + + + def width + @width ||= 200 + end + + def width=(width) + self.x2 = width + self.x3 = width + @width = width + end + + def height + @height ||= 100 + end + + def height=(height) + self.y3 = height + self.y4 = height + @height = height + end + end +end + diff --git a/lib/camera/wrappers/sprite_wrapper.rb b/lib/camera/wrappers/sprite_wrapper.rb new file mode 100644 index 0000000..58ed1f7 --- /dev/null +++ b/lib/camera/wrappers/sprite_wrapper.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +module Camera + # Wraps existing variables as well as adding new methods + # so that it can be handled by the Camera Module + module SpriteWrapped + # Recalculates real coordiantes + # Use after changing variables + def update + angle = Camera.angle * (Math::PI / 180) + half_width = Window.width * 0.5 + half_height = Window.height * 0.5 + offset_x = x + (width / 2) + offset_y = y + (height / 2) + @x = (((offset_x - Camera.x) * Math.cos(angle)) - ((offset_y - Camera.y) * Math.sin(angle))) \ + * Camera.zoom + half_width - (width * Camera.zoom / 2) + @y = (((offset_x - Camera.x) * Math.sin(angle)) + ((offset_y - Camera.y) * Math.cos(angle))) \ + * Camera.zoom + half_height - (height * Camera.zoom / 2) + @rotate = rotate + Camera.angle + @width = width * Camera.zoom + @height = height * Camera.zoom + end + + #Methods for moving the shape + + # Wrappers for the coordinates so that + # they are handled by the Camera instead + # and for ease of programming + def x + @virtual_x ||= @x + end + + def x=(x) + @virtual_x = x + end + + def y + @virtual_y ||= @y + end + + def y=(y) + @virtual_y = y + end + + def x + @virtual_x ||= @x + end + + def rotate + @virtual_rotate ||= @rotate + end + + def rotate=(rotate) + @virtual_rotate = rotate + end + + def width + @virtual_width ||= @width + end + + def width=(width) + @virtual_width = width + end + + def height + @virtual_height ||= @height + end + + def height=(height) + @virtual_height = height + end + end +end diff --git a/lib/camera/wrappers/square_wrapper.rb b/lib/camera/wrappers/square_wrapper.rb index ce0831e..f828e0c 100644 --- a/lib/camera/wrappers/square_wrapper.rb +++ b/lib/camera/wrappers/square_wrapper.rb @@ -1,63 +1,137 @@ # frozen_string_literal: true module Camera - # Wraps existing variables as well as adding new methods - # so that it can be handled by the Camera Module +# Wraps existing variables as well as adding new methods +# so that it can be handled by the Camera Module module SquareWrapped # Recalculates real coordiantes # Use after changing variables def update angle = Camera.angle * (Math::PI / 180) - half_size = Window.size * 0.5 - offset_x = x + (width / 2) - offset_y = y + (height / 2) - @x = (((offset_x - Camera.x) * Math.cos(angle)) - ((offset_y - Camera.y) * Math.sin(angle))) \ - * Camera.zoom + half_size #- (size * Camera.zoom / 2) - @y = (((offset_x - Camera.x) * Math.sin(angle)) + ((offset_y - Camera.y) * Math.cos(angle))) \ - * Camera.zoom + half_height #- (size * Camera.zoom / 2) - @rotate = rotate + Camera.angle - @size = size * Camera.zoom + half_width = Window.width * 0.5 + half_height = Window.height * 0.5 + @x1 = (((x + x1 - Camera.x) * Math.cos(angle)) - ((y + y1 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y1 = (((x + x1 - Camera.x) * Math.sin(angle)) + ((y + y1 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x2 = (((x + x2 - Camera.x) * Math.cos(angle)) - ((y + y2 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y2 = (((x + x2 - Camera.x) * Math.sin(angle)) + ((y + y2 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x3 = (((x + x3 - Camera.x) * Math.cos(angle)) - ((y + y3 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y3 = (((x + x3 - Camera.x) * Math.sin(angle)) + ((y + y3 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height + @x4 = (((x + x4 - Camera.x) * Math.cos(angle)) - ((y + y4 - Camera.y) * Math.sin(angle))) * Camera.zoom + half_width + @y4 = (((x + x4 - Camera.x) * Math.sin(angle)) + ((y + y4 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height end #Methods for moving the shape - - # Wrappers for the coordinates so that - # they are handled by the Camera instead - # and for ease of programming def x - @virtual_x ||= @x + @x ||= x1 end def x=(x) - @virtual_x = x + @x = x end def y - @virtual_y ||= @y + @y ||= y1 end def y=(y) - @virtual_y = y + @y = y end - def x - @virtual_x ||= @x + # Wrappers for the coordinates so that + # they are handled by the Camera instead + # and for ease of programming + def x1 + @virtual_x1 ||= @x1 + end + + def x1=(x1) + @virtual_x1 = x1 + end + + def y1 + @virtual_y1 ||= @y1 + end + + def y1=(y1) + @virtual_y1 = y1 + end + + def x2 + @virtual_x2 ||= @x2 + end + + def x2=(x2) + @virtual_x2 = x2 + end + + def y2 + @virtual_y2 ||= @y2 + end + + def y2=(y2) + @virtual_y2 = y2 end - def rotate - @virtual_rotate ||= @rotate + def x3 + @virtual_x3 ||= @x3 end - def rotate=(rotate) - @virtual_rotate = rotate + def x3=(x3) + @virtual_x3 = x3 + end + + def y3 + @virtual_y3 ||= @y3 + end + + def y3=(y3) + @virtual_y3 = y3 + end + + def x4 + @virtual_x4 ||= @x4 + end + + def x4=(x4) + @virtual_x4 = x4 + end + + def y4 + @virtual_y4 ||= @y4 + end + + def y4=(y4) + @virtual_y4 = y4 + end + + + def width + @width ||= 200 + end + + def width=(width) + self.x2 = width + self.x3 = width + @width = width + end + + def height + @height ||= 100 + end + + def height=(height) + self.y3 = height + self.y4 = height + @height = height end def size - @virtual_size ||= @size + @size ||= 100 end def size=(size) - @virtual_size = size + @size = self.width = self.height = size end end end + @@ -5,6 +5,8 @@ require_relative 'lib/camera/camera' #set width: 700, height: 300 +Window.set(icon: "./assets/blobdanceextract/blob#{(1...20).to_a.sample}.png") + # Use this to add a few extra methods to an Image module SizableImage def size @@ -17,17 +19,16 @@ module SizableImage end end -Window.set(icon: './assets/player.png') # There is 2 ways you can add objects to be known and controlled by the camera, both do the same thing -@square = Square.new( - x: 100, y: 100, - size: 125, - color: 'random' -) +#@square = Square.new( +# x: 100, y: 100, +# size: 125, +# color: 'random' +#) -Camera << @square +#Camera << @square 25.times do tempx = (0..1920).to_a.sample @@ -49,14 +50,40 @@ end z: -1 ) Camera << @background -@player = Triangle.new(x1: 0, - y1: 0, - x2: 0, - y2: 0 + 25, - x3: 0 + 25, - y3: 0 + 25, - size: (10..50).to_a.sample, - color: 'blue') +@line = Line.new(x1: -40, + y1: -50, + x2: 60, + y2: 70, + width: 35, + color: 'random') +Camera << @line +=begin +@player = Quad.new(x1: 0, + y1: 0, + x2: 0, + y2: 0 + 25, + x3: 0 + 25, + y3: 0 + 25, + x4: 0 + 25, + y4: 0, + size: (10..50).to_a.sample, + color: 'blue') +=end +@player = Square.new(x: 0, + y: 0, + size: 100, + color: 'random') +@sprite = Sprite.new('./assets/sprites/blob.png', + x: 300, + y: 300, + width: 100, + height: 100, + clip_width: 128, + loop: true, + time: 17) +Camera << @sprite +Camera << @player Camera << @player Rectangle.new( width: 350, @@ -154,15 +181,19 @@ end on :key_down do |event| if event.key == 'f' Camera.debug_x += 2 + @player.size -= 5 end if event.key == 'h' Camera.debug_x -= 2 + @player.size += 5 end if event.key == 't' Camera.debug_y += 2 + @player.height += 5 end if event.key == 'g' Camera.debug_y -= 2 + @player.height -= 5 end end @@ -214,10 +245,7 @@ update do @ui_zoom.text = "Zoom: #{Camera.zoom.round(3)}" @ui_fps.text = "FPS: #{Window.fps.round(2)}" @ui_rotation.text = "Angle: #{Camera.angle}" - puts "Debug X" - puts Camera.debug_x - puts "Debug Y" - puts Camera.debug_y + Camera.update end show |
