diff --git a/color-dodge-game/README.md b/color-dodge-game/README.md index 1fdd1ec..c77cfa5 100644 --- a/color-dodge-game/README.md +++ b/color-dodge-game/README.md @@ -2,7 +2,7 @@ Made by [Heitorado](https://github.com/heitorado) -**Ruby2D Version:** 0.6.0 +**Ruby2D Version:** 0.12.1 Feel free to use and modify as you wish! diff --git a/color-dodge-game/color-dodge.rb b/color-dodge-game/color-dodge.rb index 6e160ee..ad1764d 100644 --- a/color-dodge-game/color-dodge.rb +++ b/color-dodge-game/color-dodge.rb @@ -52,7 +52,7 @@ def radius # Instantiating the score text and variable score = 0 -score_text = Text.new(x: (get :width)-150, y: 10, text: "Score: #{score}", font: "../fonts/Ubuntu.ttf", color: 'white') +score_text = Text.new("Score: #{score}", x: (get :width)-150, y: 10, font: "fonts/Ubuntu.ttf", color: 'white') # Creating a lifebar lifebar = Rectangle.new(x: 10, y: 10, z: 1, width: player_life, height: 25, color: 'red') @@ -107,7 +107,7 @@ def radius dx = player.x - enemy.getBodyPosition().first dy = player.y - enemy.getBodyPosition().last - # Euclidian distance between the two centers of the squares + # Euclidean distance between the two centers of the squares distance = Math.sqrt(dx * dx + dy * dy) # If this calculated distance is less than the two radius of the shapes summed, then they are overlapping. diff --git a/keyevent-example/README.md b/keyevent-example/README.md index 733854c..c116ed9 100644 --- a/keyevent-example/README.md +++ b/keyevent-example/README.md @@ -2,7 +2,7 @@ Made by [slime-man](https://github.com/slime-man) -**Ruby2D Version:** 0.8.1 +**Ruby2D Version:** 0.12.1 An example using the `on` method to capture `KeyEvents`. It displays the keys you type, like stamps on the screen. diff --git a/keyevent-example/keyevent-example.rb b/keyevent-example/keyevent-example.rb index b9fb98c..40e99f8 100644 --- a/keyevent-example/keyevent-example.rb +++ b/keyevent-example/keyevent-example.rb @@ -7,7 +7,7 @@ set title: "KeyEvent Example" text_size = 20 -font_path = "../fonts/Ubuntu.ttf" +font_path = "fonts/Ubuntu.ttf" on :key_down do |k| key = k['key'] diff --git a/toggle-switch/README.md b/toggle-switch/README.md index a46c5dd..0d5e130 100644 --- a/toggle-switch/README.md +++ b/toggle-switch/README.md @@ -2,7 +2,7 @@ Made by [Tobias Wilfert](https://github.com/tobias-wilfert) -**Ruby2D Version:** 0.8.1 +**Ruby2D Version:** 0.12.1 Feel free to use and modify as you wish! diff --git a/triangle-game/triangle-game.rb b/triangle-game/triangle-game.rb index f2c36c2..b6b370d 100644 --- a/triangle-game/triangle-game.rb +++ b/triangle-game/triangle-game.rb @@ -1,5 +1,5 @@ # A simple "Triangle Game" that allows you to move a Roguelike '@' around the -# window (and off of it). This is a working example on MacOS 10.12 as of Dec 16, 2017. +# window (and off of it). This is a working example on MacOS 15.2 as of Jan 24, 2025. # This combines some of the Ruby2D tutorial code with keypress management # that actually works. # @@ -24,9 +24,9 @@ color: ['red', 'green', 'blue'] ) -msg = Text.new(x: 320, y: 240, text: 'Hi, Tres!', size: 20, font: '../fonts/Ubuntu.ttf') +msg = Text.new('Hi, Tres!', x: 320, y: 240, size: 20, font: 'fonts/Ubuntu.ttf') -player = Text.new(x: 0, y: 0, text: '@', size: 32, font: '../fonts/Ubuntu.ttf'); +player = Text.new('@', x: 0, y: 0, size: 32, font: 'fonts/Ubuntu.ttf') msg.x = 320 - msg.width / 2 msg.y = 240 - msg.height / 2 @@ -35,7 +35,6 @@ t = Time.now on :key do |e| - # puts e if e.type == :down case e.key when 'j' @@ -57,8 +56,6 @@ set background: 'random' end tick += 1 - # Close the window after 5 seconds - #if Time.now - t > 5 then close end end show