0

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 title: 'random'//this maked the title 'random'

i hope you can help me UPDATE: I managed to fix the background

1 Answers1

0

When you set background, random is a keyword, but when you use it for title is like a normal word.

Try this:

require 'ruby2d'

def generate_code(number)
  charset = Array('A'..'Z') + Array('a'..'z')
  Array.new(number) { charset.sample }.join
end


random_title = generate_code(20) 
set title: random_title
set background: 'random' #this worked,but when i try to add a loop to it,nope


show
Nifriz
  • 1,033
  • 1
  • 10
  • 21