Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion color-dodge-game/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
4 changes: 2 additions & 2 deletions color-dodge-game/color-dodge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion keyevent-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion keyevent-example/keyevent-example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion toggle-switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
9 changes: 3 additions & 6 deletions triangle-game/triangle-game.rb
Original file line number Diff line number Diff line change
@@ -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.
#
Expand All @@ -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
Expand All @@ -35,7 +35,6 @@
t = Time.now

on :key do |e|
# puts e
if e.type == :down
case e.key
when 'j'
Expand All @@ -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
Expand Down