From cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb Mon Sep 17 00:00:00 2001 From: realtradam Date: Sun, 8 Aug 2021 02:14:53 -0400 Subject: fixed formatting and file structure --- .rubocop.yml | 6 +- assets/background.png | Bin 60142 -> 0 bytes assets/blobcoolthink.png | Bin 13066 -> 0 bytes assets/blobshadow.png | Bin 5679 -> 0 bytes assets/bricktexture.png | Bin 741798 -> 0 bytes assets/legacy_player.png | Bin 1044 -> 0 bytes assets/sprites/alienpls-56.png | Bin 255710 -> 0 bytes assets/sprites/blobdance-128.png | Bin 35825 -> 0 bytes assets/sprites/dance2-112.png | Bin 214857 -> 0 bytes assets/sprites/dancer-128.png | Bin 39270 -> 0 bytes assets/sprites/mainblob-128.png | Bin 94731 -> 0 bytes example/assets/background.png | Bin 0 -> 60142 bytes example/assets/blobcoolthink.png | Bin 0 -> 13066 bytes example/assets/blobshadow.png | Bin 0 -> 5679 bytes example/assets/bricktexture.png | Bin 0 -> 741798 bytes example/assets/legacy_player.png | Bin 0 -> 1044 bytes example/assets/sprites/alienpls-56.png | Bin 0 -> 255710 bytes example/assets/sprites/blobdance-128.png | Bin 0 -> 35825 bytes example/assets/sprites/dance2-112.png | Bin 0 -> 214857 bytes example/assets/sprites/dancer-128.png | Bin 0 -> 39270 bytes example/assets/sprites/mainblob-128.png | Bin 0 -> 94731 bytes example/house.rb | 100 ++++++++++++++ example/room.rb | 129 ++++++++++++++++++ example/run.rb | 223 +++++++++++++++++++++++++++++++ house.rb | 103 -------------- lib/camera/camera.rb | 125 ----------------- lib/camera/wrappers/circle_wrapper.rb | 47 ------- lib/camera/wrappers/image_wrapper.rb | 73 ---------- lib/camera/wrappers/line_wrapper.rb | 91 ------------- lib/camera/wrappers/quad_wrapper.rb | 108 --------------- lib/camera/wrappers/rectangle_wrapper.rb | 138 ------------------- lib/camera/wrappers/sprite_wrapper.rb | 86 ------------ lib/camera/wrappers/square_wrapper.rb | 146 -------------------- lib/camera/wrappers/text_wrapper.rb | 84 ------------ lib/camera/wrappers/triangle_wrapper.rb | 90 ------------- lib/ruby2d/camera.rb | 10 +- lib/ruby2d/camera/circle.rb | 8 +- lib/ruby2d/camera/image.rb | 32 ++--- lib/ruby2d/camera/line.rb | 32 ++--- lib/ruby2d/camera/quad.rb | 26 ++-- lib/ruby2d/camera/rectangle.rb | 26 ++-- lib/ruby2d/camera/sprite.rb | 22 +-- lib/ruby2d/camera/square.rb | 27 ++-- lib/ruby2d/camera/text.rb | 20 ++- lib/ruby2d/camera/triangle.rb | 25 ++-- lib/ruby2d/camera/version.rb | 2 +- room.rb | 132 ------------------ run.rb | 1 - test.rb | 17 --- 49 files changed, 558 insertions(+), 1371 deletions(-) delete mode 100644 assets/background.png delete mode 100644 assets/blobcoolthink.png delete mode 100644 assets/blobshadow.png delete mode 100644 assets/bricktexture.png delete mode 100644 assets/legacy_player.png delete mode 100644 assets/sprites/alienpls-56.png delete mode 100644 assets/sprites/blobdance-128.png delete mode 100644 assets/sprites/dance2-112.png delete mode 100644 assets/sprites/dancer-128.png delete mode 100644 assets/sprites/mainblob-128.png create mode 100644 example/assets/background.png create mode 100644 example/assets/blobcoolthink.png create mode 100644 example/assets/blobshadow.png create mode 100644 example/assets/bricktexture.png create mode 100644 example/assets/legacy_player.png create mode 100644 example/assets/sprites/alienpls-56.png create mode 100644 example/assets/sprites/blobdance-128.png create mode 100644 example/assets/sprites/dance2-112.png create mode 100644 example/assets/sprites/dancer-128.png create mode 100644 example/assets/sprites/mainblob-128.png create mode 100644 example/house.rb create mode 100644 example/room.rb create mode 100644 example/run.rb delete mode 100644 house.rb delete mode 100644 lib/camera/camera.rb delete mode 100644 lib/camera/wrappers/circle_wrapper.rb delete mode 100644 lib/camera/wrappers/image_wrapper.rb delete mode 100644 lib/camera/wrappers/line_wrapper.rb delete mode 100644 lib/camera/wrappers/quad_wrapper.rb delete mode 100644 lib/camera/wrappers/rectangle_wrapper.rb delete mode 100644 lib/camera/wrappers/sprite_wrapper.rb delete mode 100644 lib/camera/wrappers/square_wrapper.rb delete mode 100644 lib/camera/wrappers/text_wrapper.rb delete mode 100644 lib/camera/wrappers/triangle_wrapper.rb delete mode 100644 room.rb delete mode 100644 test.rb diff --git a/.rubocop.yml b/.rubocop.yml index bfef2d0..adb3cb9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,13 +1,13 @@ AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 3.0 Style/StringLiterals: Enabled: true - EnforcedStyle: double_quotes + EnforcedStyle: single_quotes Style/StringLiteralsInInterpolation: Enabled: true - EnforcedStyle: double_quotes + EnforcedStyle: single_quotes Layout/LineLength: Max: 120 diff --git a/assets/background.png b/assets/background.png deleted file mode 100644 index f411e96..0000000 Binary files a/assets/background.png and /dev/null differ diff --git a/assets/blobcoolthink.png b/assets/blobcoolthink.png deleted file mode 100644 index 7cdfcc8..0000000 Binary files a/assets/blobcoolthink.png and /dev/null differ diff --git a/assets/blobshadow.png b/assets/blobshadow.png deleted file mode 100644 index ff981cb..0000000 Binary files a/assets/blobshadow.png and /dev/null differ diff --git a/assets/bricktexture.png b/assets/bricktexture.png deleted file mode 100644 index 4ef86e0..0000000 Binary files a/assets/bricktexture.png and /dev/null differ diff --git a/assets/legacy_player.png b/assets/legacy_player.png deleted file mode 100644 index 485e972..0000000 Binary files a/assets/legacy_player.png and /dev/null differ diff --git a/assets/sprites/alienpls-56.png b/assets/sprites/alienpls-56.png deleted file mode 100644 index af9452a..0000000 Binary files a/assets/sprites/alienpls-56.png and /dev/null differ diff --git a/assets/sprites/blobdance-128.png b/assets/sprites/blobdance-128.png deleted file mode 100644 index 6326ec0..0000000 Binary files a/assets/sprites/blobdance-128.png and /dev/null differ diff --git a/assets/sprites/dance2-112.png b/assets/sprites/dance2-112.png deleted file mode 100644 index 2d69026..0000000 Binary files a/assets/sprites/dance2-112.png and /dev/null differ diff --git a/assets/sprites/dancer-128.png b/assets/sprites/dancer-128.png deleted file mode 100644 index c3fdbc0..0000000 Binary files a/assets/sprites/dancer-128.png and /dev/null differ diff --git a/assets/sprites/mainblob-128.png b/assets/sprites/mainblob-128.png deleted file mode 100644 index ca78578..0000000 Binary files a/assets/sprites/mainblob-128.png and /dev/null differ diff --git a/example/assets/background.png b/example/assets/background.png new file mode 100644 index 0000000..f411e96 Binary files /dev/null and b/example/assets/background.png differ diff --git a/example/assets/blobcoolthink.png b/example/assets/blobcoolthink.png new file mode 100644 index 0000000..7cdfcc8 Binary files /dev/null and b/example/assets/blobcoolthink.png differ diff --git a/example/assets/blobshadow.png b/example/assets/blobshadow.png new file mode 100644 index 0000000..ff981cb Binary files /dev/null and b/example/assets/blobshadow.png differ diff --git a/example/assets/bricktexture.png b/example/assets/bricktexture.png new file mode 100644 index 0000000..4ef86e0 Binary files /dev/null and b/example/assets/bricktexture.png differ diff --git a/example/assets/legacy_player.png b/example/assets/legacy_player.png new file mode 100644 index 0000000..485e972 Binary files /dev/null and b/example/assets/legacy_player.png differ diff --git a/example/assets/sprites/alienpls-56.png b/example/assets/sprites/alienpls-56.png new file mode 100644 index 0000000..af9452a Binary files /dev/null and b/example/assets/sprites/alienpls-56.png differ diff --git a/example/assets/sprites/blobdance-128.png b/example/assets/sprites/blobdance-128.png new file mode 100644 index 0000000..6326ec0 Binary files /dev/null and b/example/assets/sprites/blobdance-128.png differ diff --git a/example/assets/sprites/dance2-112.png b/example/assets/sprites/dance2-112.png new file mode 100644 index 0000000..2d69026 Binary files /dev/null and b/example/assets/sprites/dance2-112.png differ diff --git a/example/assets/sprites/dancer-128.png b/example/assets/sprites/dancer-128.png new file mode 100644 index 0000000..c3fdbc0 Binary files /dev/null and b/example/assets/sprites/dancer-128.png differ diff --git a/example/assets/sprites/mainblob-128.png b/example/assets/sprites/mainblob-128.png new file mode 100644 index 0000000..ca78578 Binary files /dev/null and b/example/assets/sprites/mainblob-128.png differ diff --git a/example/house.rb b/example/house.rb new file mode 100644 index 0000000..c6257ee --- /dev/null +++ b/example/house.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +# Is a house +class House + def initialize(x, y) + @objects = [] + @x = x + @y = y + @objects.push Camera::Image.new('assets/blobshadow.png', + width: 320, + height: 250, + x: x - 10, + y: y + 130, + z: 0) + @objects.push Camera::Image.new('assets/bricktexture.png', + x: x, + y: y, + width: 300, + height: 300) + @objects.push Camera::Square.new(x: 125 + x, + y: 230 + y, + size: 50, + color: 'black') + @objects.push Camera::Circle.new(x: 125 + x, + y: 205 + y, + radius: 25, + color: 'black') + @objects.push Camera::Triangle.new(x1: -5 + x, + y1: 16 + y, + x2: 310 + x, + y2: 14 + y, + x3: 150 + x, + y3: -75 + y, + color: 'red') + @objects.push Camera::Square.new(x: 160 + x, + y: 20 + y, + size: 100, + color: 'brown', + z: 1) + @objects.push Camera::Square.new(x: 170 + x, + y: 25 + y, + size: 80, + opacity: 0.5, + color: 'blue', + z: 2) + @objects.push Camera::Rectangle.new(x: 160 + x, + y: 105 + y, + width: 100, + height: 20, + color: 'brown', + z: 3) + @objects.push Camera::Line.new(x1: 210 + x, + y1: 105 + y, + x2: 210 + x, + y2: 25 + y, + width: 4, + color: 'brown', + z: 3) + @objects.push Camera::Line.new(x1: 250 + x, + y1: 65 + y, + x2: 170 + x, + y2: 65 + y, + width: 4, + color: 'brown', + z: 3) + @objects.push Camera::Sprite.new('./assets/sprites/alienpls-56.png', + x: 175 + x, + y: 65 + y, + width: 56, + height: 56, + clip_width: 56, + loop: true, + time: 35, + z: 1) + @objects.last.play + # @objects.each do |item| + # Camera << item + # end + end + + def remove + @objects.each do |item| + # Camera.remove item + item.remove + end + end + + def visted_by?(character) + x = @x + 80 + y = @y + 160 + if character.x >= x && character.x <= (x + (character.width * 2)) && character.y > y && character.y <= (y + (character.height * 2)) + Camera::Text.new('Press Space To Enter House', + x: x + 70, + y: y + 30, + color: 'white', + z: 98, + size: 25.0) + end + end +end diff --git a/example/room.rb b/example/room.rb new file mode 100644 index 0000000..27c002d --- /dev/null +++ b/example/room.rb @@ -0,0 +1,129 @@ +# frozen_string_literal: true + +# Is a house +class Room + def initialize(x, y) + @objects = [] + @x = x + @y = y + roomy = 155 + @objects.push Camera::Square.new(x: 125 + x, + y: 230 + y, + size: 50, + color: 'blue', + z: 3) + @objects.push Camera::Circle.new(x: 125 + x, + y: 205 + y, + radius: 25, + sectors: 64, + color: 'blue', + z: 3) + @objects.push Camera::Quad.new(x1: 50 + x, + y1: 130 + y + roomy, + x2: 125 + x, + y2: 180 + y + roomy, + x3: 325 + x, + y3: 180 + y + roomy, + x4: 250 + x, + y4: 130 + y + roomy, + color: 'aqua', + z: 1) + @objects.push Camera::Quad.new(x1: 50 + x, + y1: 45 + y + roomy, + x2: 50 + x, + y2: 125 + y + roomy, + x3: 250 + x, + y3: 125 + y + roomy, + x4: 250 + x, + y4: 45 + y + roomy, + color: 'orange', + z: 1) + @objects.push Camera::Quad.new(x1: 255 + x, + y1: 45 + y + roomy, + x2: 255 + x, + y2: 125 + y + roomy, + x3: 330 + x, + y3: 175 + y + roomy, + x4: 330 + x, + y4: 95 + y + roomy, + color: 'olive', + z: 1) + @objects.push Camera::Sprite.new('./assets/sprites/blobdance-128.png', + x: 250 + x, + y: 135 + y + roomy, + width: 40, + height: 40, + clip_width: 128, + loop: true, + time: 24, + z: 5) + @objects.last.play + @objects.push Camera::Image.new( + 'assets/blobshadow.png', + x: 250 + x - 2 - 5, + y: 135 + y + roomy + 42 - 15, + width: 52, + height: 10, + z: 4 + ) + @objects.push Camera::Sprite.new('./assets/sprites/dance2-112.png', + x: 95 + x, + y: 115 + y + roomy, + width: 40, + height: 40, + clip_width: 112, + loop: true, + time: 13, + z: 5) + @objects.last.play + @objects.push Camera::Image.new( + 'assets/blobshadow.png', + x: 95 + x - 2 - 5, + y: 115 + y + roomy + 42 - 10, + width: 52, + height: 10, + z: 4 + ) + @objects.push Camera::Sprite.new('./assets/sprites/dancer-128.png', + x: 175 + x, + y: 120 + y + roomy, + width: 45, + height: 45, + clip_width: 128, + loop: true, + time: 60, + z: 5) + @objects.last.play + @objects.push Camera::Image.new( + 'assets/blobshadow.png', + x: 175 + x - 2 - 5, + y: 120 + y + roomy + 42 - 5, + width: 52, + height: 10, + z: 4 + ) + # @objects.each do |item| + # Camera << item + # end + end + + def remove + @objects.each do |item| + # Camera.remove item + item.remove + end + end + + def visted_by?(character) + x = @x + 80 + y = @y + 160 + if character.x >= x && character.x <= (x + (character.width * 2)) && character.y > y && character.y <= (y + (character.height * 2)) + Camera::Text.new('Press Space To Exit House', + x: x + 70, + y: y + 30, + color: 'white', + z: 98, + size: 25.0) + end + end +end diff --git a/example/run.rb b/example/run.rb new file mode 100644 index 0000000..96ab9ab --- /dev/null +++ b/example/run.rb @@ -0,0 +1,223 @@ +# frozen_string_literal: true + +require 'ruby2d' +require 'ruby2d/camera' +require_relative 'house' +require_relative 'room' + +Window.set(icon: './assets/blobcoolthink.png', + width: 1280, + height: 720, + background: 'blue') + +@player = Camera::Sprite.new('./assets/sprites/mainblob-128.png', + x: 1920 / 1.1, + y: 1080 / 1.1, + width: 50, + height: 50, + clip_width: 128, + loop: true, + time: 1, + z: 99, + animations: { + walk: 0...60, + stand: 60...61 + }) +@shadow = Camera::Image.new( + 'assets/blobshadow.png', + width: 52, + height: 10, + z: 4 +) +@player.play animation: :walk, loop: true + +# UI +Rectangle.new( + width: 350, + height: 135, + color: 'navy', + z: 100 +) +@ui_pos_cam = Text.new( + 'pos: 0,0', + x: 10, + y: 10, + color: 'teal', + z: 101 +) +@ui_pos_ply = Text.new( + 'pos: 0,0', + x: 10, + y: 40, + color: 'teal', + z: 101 +) +@ui_zoom = Text.new( + 'zoom: 0', + x: 10, + y: 70, + color: 'lime', + z: 101 +) +@ui_rotation = Text.new( + 'rotation: 0', + x: 10, + y: 100, + color: 'lime', + z: 101 +) +Rectangle.new( + x: (Window.width - 120), + width: 120, + height: 45, + color: 'navy', + z: 100 +) +@ui_fps = Text.new( + 'fps: 60.00', + x: (Window.width - 110), + y: 10, + color: 'teal', + z: 101 +) + +# How fast the player can move +@speed = 5 + +# Initializing +@player_movement_x = 0 +@player_movement_y = 0 +@pressed_space = false +@scene_transition_into = false +@scene_transition_out = false +@indoors = false +@house = nil +@room = nil + +on :key do |event| + @player_movement_y -= @speed if event.key == 'w' && !(@scene_transition_into || @scene_transition_out) + @player_movement_y += @speed if event.key == 's' && !(@scene_transition_into || @scene_transition_out) + @player_movement_x += @speed if event.key == 'd' && !(@scene_transition_into || @scene_transition_out) + @player_movement_x -= @speed if event.key == 'a' && !(@scene_transition_into || @scene_transition_out) + @pressed_space = true if event.key == 'space' && !(@scene_transition_into || @scene_transition_out) + Camera.angle += 1 if event.key == 'q' && !(@scene_transition_into || @scene_transition_out) + Camera.angle -= 1 if event.key == 'e' && !(@scene_transition_into || @scene_transition_out) + if event.key == 'r' && !(@scene_transition_into || @scene_transition_out || Camera.angle.zero?) + if Camera.angle <= 180 + Camera.angle -= if Camera.angle > 10 + 10 + else + 1 + end + elsif Camera.angle += if Camera.angle < 350 + 10 + else + 1 + end + end + end +end + +update do + if (@player.x > 2371 && @player_movement_x.positive?) || (@player.x.negative? && @player_movement_x.negative?) + @player_movement_x = 0 + end + if (@player.y > 1608 && @player_movement_y.positive?) || (@player.y.negative? && @player_movement_y.negative?) + @player_movement_y = 0 + end + if !@player_movement_y.zero? == !@player_movement_x.zero? + @player_movement_x /= 1.4141 + @player_movement_y /= 1.4141 + end + @player.x += @player_movement_x + @player.y += @player_movement_y + if @player_movement_x.negative? + @player.play animation: :walk, loop: true + elsif @player_movement_x.positive? || !@player_movement_y.zero? + @player.play animation: :walk, loop: true, flip: :vertical + else + @player.play animation: :stand + end + + if !@scene_transition_into && !@scene_transition_out + Camera.zoom += ((-[ + Math.sqrt(((@player.x + (@player.width / 2) - Camera.x)**2) + ((@player.y + (@player.width / 2) - Camera.y)**2)), 350 + ].min * 0.004) + 2 - Camera.zoom) * 0.25 + Camera.x += (@player.x + (@player.width / 2) - Camera.x) * 0.025 + Camera.y += (@player.y + (@player.height / 2) - Camera.y) * 0.025 + elsif @scene_transition_into + if Camera.zoom < 250 + Camera.zoom *= 1.05 + Camera.angle += 5 + else + @scene_transition_into = false + @scene_transition_out = true + if @room.nil? + @house.remove + @house = nil + @indoors = true + else + @room.remove + @room = nil + @indoors = false + end + @background.remove + @background = nil + end + Camera.x += (@player.x + (@player.width / 2) - Camera.x) * 0.25 + Camera.y += (@player.y + (@player.height / 2) - Camera.y) * 0.25 + elsif @scene_transition_out + if !((Camera.zoom <= (@zoom_transition * 1.001)) && (Camera.angle == @angle_transition)) + Camera.zoom /= 1.05 + Camera.angle -= 5 + else + @scene_transition_out = false + end + end + + if @house.nil? && !@indoors + @house = House.new(750, 300) + @background = Camera::Image.new( + 'assets/background.png', + x: 100, y: 100, + z: -1 + ) + elsif @room.nil? && @indoors + @room = Room.new(750, 300) + @background = Camera::Rectangle.new( + color: 'black', + x: 0, + y: 0, + width: 1920, + height: 1080, + z: -1 + ) + end + @shadow.x = @player.x - 2 + @shadow.y = @player.y + 42 + + @house_text&.remove + @house_text = if @indoors + @room.visted_by?(@player) + else + @house.visted_by?(@player) + end + unless @house_text.nil? + @house_text.center = true + end + if !@house_text.nil? && @pressed_space && !@scene_transition_into && !@scene_transition_out + @scene_transition_into = true + @angle_transition = Camera.angle + @zoom_transition = Camera.zoom + end + @ui_pos_cam.text = "Camera Position: #{Camera.x.round(1)}, #{Camera.y.round(1)}" + @ui_pos_ply.text = "Player Position: #{@player.x.round(1)}, #{@player.y.round(1)}" + @ui_zoom.text = "Zoom: #{Camera.zoom.round(3)}" + @ui_fps.text = "FPS: #{Window.fps.round(2)}" + @ui_rotation.text = "Angle: #{Camera.angle}" + @player_movement_x = 0 + @player_movement_y = 0 + @pressed_space = false + +end +show diff --git a/house.rb b/house.rb deleted file mode 100644 index b4b495f..0000000 --- a/house.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -# Is a house -class House - def initialize(x, y) - @objects = [] - @x = x - @y = y - @objects.push Camera::Image.new('assets/blobshadow.png', - width: 320, - height: 250, - x: x - 10, - y: y + 130, - z: 0) - @objects.push Camera::Image.new('assets/bricktexture.png', - x: x, - y: y, - width: 300, - height: 300) - @objects.push Camera::Square.new(x: 125 + x, - y: 230 + y, - size: 50, - color: 'black') - @objects.push Camera::Circle.new(x: 125 + x, - y: 205 + y, - radius: 25, - color: 'black') - @objects.push Camera::Triangle.new(x1: -5 + x, - y1: 16 + y, - x2: 310 + x, - y2: 14 + y, - x3: 150 + x, - y3: -75 + y, - color: 'red') - @objects.push Camera::Square.new(x: 160 + x, - y: 20 + y, - size: 100, - color: 'brown', - z: 1) - @objects.push Camera::Square.new(x: 170 + x, - y: 25 + y, - size: 80, - opacity: 0.5, - color: 'blue', - z: 2) - @objects.push Camera::Rectangle.new(x: 160 + x, - y: 105 + y, - width: 100, - height: 20, - color: 'brown', - z: 3) - @objects.push Camera::Line.new(x1: 210 + x, - y1: 105 + y, - x2: 210 + x, - y2: 25 + y, - width: 4, - color: 'brown', - z: 3) - @objects.push Camera::Line.new(x1: 250 + x, - y1: 65 + y, - x2: 170 + x, - y2: 65 + y, - width: 4, - color: 'brown', - z: 3) - @objects.push Camera::Sprite.new('./assets/sprites/alienpls-56.png', - x: 175 + x, - y: 65 + y, - width: 56, - height: 56, - clip_width: 56, - loop: true, - time: 35, - z: 1) - @objects.last.play - #@objects.each do |item| - # Camera << item - #end - end - - def remove - @objects.each do |item| - #Camera.remove item - item.remove - end - end - - def visted_by?(character) - x = @x + 80 - y = @y + 160 - if character.x >= x && character.x <= (x + (character.width * 2)) && character.y > y && character.y <= (y + (character.height * 2)) - Camera::Text.new('Press Space To Enter House', - x: x + 70, - y: y + 30, - color: 'white', - z: 98, - size: 25.0) - else - nil - end - end -end - diff --git a/lib/camera/camera.rb b/lib/camera/camera.rb deleted file mode 100644 index 64e2095..0000000 --- a/lib/camera/camera.rb +++ /dev/null @@ -1,125 +0,0 @@ -# frozen_string_literal: true - -Dir[File.join(__dir__, 'wrappers', '*.rb')].sort.each { |file| require file } - -# Handles rendering objects relative -# to a camera location -module Camera - class <= x && character.x <= (x + (character.width * 2)) && character.y > y && character.y <= (y + (character.height * 2)) - Camera::Text.new('Press Space To Exit House', - x: x + 70, - y: y + 30, - color: 'white', - z: 98, - size: 25.0) - else - nil - end - end -end - diff --git a/run.rb b/run.rb index 69f22f8..6e5c69c 100644 --- a/run.rb +++ b/run.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'ruby2d' -#require_relative 'lib/camera/camera' require 'ruby2d/camera' require_relative 'house' require_relative 'room' diff --git a/test.rb b/test.rb deleted file mode 100644 index dd2b8f1..0000000 --- a/test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'ruby2d' -require 'ruby2d/camera' - -Camera::Quad.new -#Camera::Image.new('./assets/bricktexture.png') -#@test = Image.new('./assets/bricktexture.png') -#@test.remove -update do -# @test.draw(x: get(:mouse_x), -# y: get(:mouse_y)) -# @test.x = get(:mouse_x) -# @test.y = get(:mouse_y) - Camera.x = get(:mouse_x) - Camera.angle = get(:mouse_y) -end - -show -- cgit v1.2.3