Hi All,
First time here. First of all Thanks to the creators of Processing , ruby-processing and rubyonprocessing. Great work. I have been trying the plain vanillla PDE and also the various ruby implementations. However I have ran into a problem everytime I try to use the ">=" or "<=" I run into trouble. The jruby stack elided error is not helping much. I would rather do all my coding in the original PDE but my computer seems to take forever to load it. (ArchLinux Kernel 2.6.29 jdk6) Hence I am using the two ruby versions. However both 'rp5' and 'rop' are crashing at the same point. I have attached the file. I hope it is not some stupid mistake on my part. If so I'm sorry. But I have honestly checked all that I could before posting this.
Thanks for all your help in advance.
--- sorry I had to use this instead of attaching the file.
#def initialize
# @win_width = 400
# @win_height = 300
#end
public class Ball
@@ball_counter = 0
def initialize(temprad )
@temprad = temprad
@xpos = random(width)
@ypos = random(height)
@xspeed = random(-5,5)
@yspeed = random(-5,5)
@ballcolor = color(100,50)
@@ball_counter += 1
end
#this creates setter and getter methods for
#@temprad
attr_accessor :temprad , :xpos , :ypos, :xspeed, :yspeed, :ballcolor
def move
@xpos += @xspeed
@ypos += @yspeed
if @x > width
@xspeed *= -1
end
#if (@x > width || @x < 0)
# @xspeed *= -1
#end
#
#
#if (@y > height || @y < 0)
# @yspeed *= -1
#end
#if (@x > @win_height || @x < 0)
# @xspeed *= -1
#end
#if (@y > @win_height || @y < 0)
# @yspeed *= -1
#end
end
def display
stroke 0
fill @ballcolor
ellipse @xpos, @ypos, @temprad * 2, @temprad * 2
end
#Class method (also called static method
def Ball.number_of_Balls
@@ball_counter
end
end
def setup
size 400, 300 #width, height
end
def draw
background 205
aBall = Ball.new 25
bBall = Ball.new 50
aBall.display
bBall.display
aBall.move
bBall.move
end