Questions tagged [ruby2d]

Ruby2D is a community-developed, cross-platform 2D application library for Ruby.

The ruby gem Ruby2D provides a library for the development of cross-platform 2D applications for ruby. Ruby2D is a community-developed open-source project. You can contribute code here.

To be able to use Ruby2D, your ruby environment must be able to build native extensions.

For Windows and MacOS you can install Ruby2D directly without dependencies with:

gem install ruby2d

For Linux, you will have to install additional dependencies, which can be found here.

18 questions
2
votes
1 answer

How to create border in ruby2d?

I am making a 2d shape editor with ruby2d. It's very simple, but there are some things it needs to support. Now I'm stuck with creating a border(I made the same object slightly bigger than the main and put it behind). The main issue is when I change…
1
vote
1 answer

Possibly a error within ruby2d's library method regarding Audio input?

undefined method `pause' for #> (NoMethodError) pause or stop etc is a built-in method in ruby2d but I can not seem to make this work. I think that…
Simplylmk
  • 267
  • 6
1
vote
1 answer

`no implicit conversion of nil into String` wih ruby2d

So for practice with ruby, I am creating a library on top of ruby2d, but one problem. I keep getting an error, I think setting up a window, here is the full error: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby2d-0.11.3/lib/ruby2d/window.rb:476:in…
theLawyer
  • 13
  • 5
1
vote
0 answers

Ocra error "No such file or directory @ rb_sysopen" in Ocra when compiling

"No such file or directory @ rb_sysopen - C:/Users//OneDrive/Desktop/ruby/fiber.so (Errno::ENOENT)" keeps getting thrown by Ocra when I try to compile my app into an exe. I've used fixes mentioned by others but none of them work, likely because most…
1
vote
1 answer

Ruby2d not working in WSL2 on Ubuntu 18.04 - Getting error "No available video device"

I'm using WSL2 on Ubuntu 18.04 to run Ruby code in Windows 10. For example, running Ruby on Rails is easily done with no special setup required. In case of Ruby2D: The installation went fine but, I get an error when running any Ruby2D file, even the…
taz mazia
  • 182
  • 10
1
vote
1 answer

How do I fix the error couldn't find packages needed when installing the gem ruby2d?

I have been trying to install the gem Ruby2D (https://www.ruby2d.com/learn/get-started )on my WSL Ubuntu. But I'm getting the following error after I run gem install ruby2d: == Ruby 2D Installation Errors…
1
vote
2 answers

How do you update and change an object in ruby 2D?

I have a text object in ruby 2D showing score. How do I update the text? I have this so far update do text = Text.new("Score: #{@score}") end Instead of replacing it, it is creating a new text object on top of it. How could you…
RMP777
  • 13
  • 3
0
votes
0 answers

Ruby2d doesn't start on windows 7

I tried installing ruby2d on Windows 10 and it works perfectly, but when I try to install on my old PC that is on Windows 7, it installs in Gemfile but it doesn't work. This error shows up: 'require': cannot load such file -- ruby2d (LoadError)
0
votes
1 answer

Detect when two rectangles touch horizontally or vertically

I have these two methods to determine collisions on the x-axis and y-axis: def horizontal_overlap(char, object) char.x + char.width > object.x && char.x < object.x + object.width #Endl end def vertical_overlap(char, object) object.y +…
IssUseless
  • 47
  • 5
0
votes
1 answer

How to Check if a User :key_down is Present in an Array/String

I am building a Hangman game in Ruby2d. I want to be able to tell if the key a user presses is present within an array of my chosen word. I tried this, but nothing happens at all: on :key_down do |event| if chosen_array.include? event.key …
0
votes
1 answer

I am simply trying to use ruby 2d and it is not showing me any output

I require 'ruby2d' in my code and write a simple program to build onto for my snake game. I am trying to get the program to pop-up a window on the screen. This is my code require 'ruby2d' set background: 'navy' #width = 640 / 20 =32 #height = 480…
0
votes
1 answer

How can i keep randomizing the title in Ruby2D?

how can i keep randomizing the background and the title forever in Ruby2D?(Yes i want to destroy my computer) Now,I tried this but it didnt work: require 'ruby2d' set background: 'random'//this worked,but when i try to add a loop to it,nope set…
0
votes
0 answers

Why will my blocks not move to the right in ruby 2d?

So I am attempting to replicate the game stacker in ruby2d. I have draw my three starting blocks to the screen, but I am having trouble making them move to the right when the game starts. here is the beginning of the class(mainly put here to show…
maxwe11
  • 309
  • 3
  • 8
0
votes
1 answer

How do you detect when simple objects intersect in ruby 2D?

So I'm a beginner to ruby and I was playing around with collision detection in ruby 2d. I have a controllable square and a square that stays still. My question is how do to detect when the square collides with the circle. This is my main code the…
RMP777
  • 13
  • 3
0
votes
1 answer

Detect if snake touches apple Ruby2d

I am right now creating a snake game in ruby 2d and need a way for the computer to detect when the snake touches the apple. I have found nothing on this topic as the ruby2d community is fairly small.
import_hill
  • 101
  • 3
1
2