Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / StickBall how to correct alpha with current Gosu version?
- - By sylvain303 Date 2017-02-14 04:35
Hi,

I cloned a game I fetched from this forum: https://github.com/MattLemmon/StickBall

I would like to make it works with current gosu version.

+gem "gosu", ">= 0.10.0-pre1"

I got some strange exception on color alpha correction.

/home/sylvain/code/ruby/StickBall/rb/lense_flare.rb:30:in update_colors': private method alpha=' called for #<Gosu::Color:ARGB=0xff_0000ff> (NoMethodError)
Did you mean?  alpha
  from /home/sylvain/code/ruby/StickBall/rb/lense_flare.rb:19:in update'
  from /home/sylvain/code/ruby/StickBall/rb/lense_flares.rb:28:in
each'
  from /home/sylvain/code/ruby/StickBall/rb/lense_flares.rb:28:in update'
  from /home/sylvain/code/ruby/StickBall/rb/beginning.rb:140:in
update'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/chingu-0.8.1/lib/chingu/game_state_manager.rb:273:in update'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/chingu-0.8.1/lib/chingu/window.rb:165:in
intermediate_update'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/chingu-0.8.1/lib/chingu/window.rb:133:in update'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/gosu-0.11.1.pre1/lib/gosu/patches.rb:152:in
tick'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/gosu-0.11.1.pre1/lib/gosu/patches.rb:152:in tick'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/gosu-0.11.1.pre1/lib/gosu/swig_patches.rb:45:in
show'
  from /home/sylvain/.rvm/gems/ruby-2.4.0-rc1/gems/gosu-0.11.1.pre1/lib/gosu/swig_patches.rb:45:in show'
  from main.rb:136:in
<main>'


I don't understand yet why it is not available anymore, and by what to change it.
https://github.com/MattLemmon/StickBall/blob/master/rb/lense_flare.rb#L30

Shouldn't have https://github.com/MattLemmon/StickBall/blob/master/rb/lense_flare.rb#L29 also raised the same exception before?
commenting line 30 make it pass…

http://www.rubydoc.info/github/gosu/gosu/Gosu/Color:alpha=

(Note github code link is broken: [View on GitHub] = https://github.com/gosu/gosu/blob/Gosu/rdoc/gosu.rb#L105)
Parent - By jlnr (dev) Date 2017-02-26 10:47
Sorry for the long delay, I have been travelling. You have probably tried to change a predefined colour:

color = Gosu::Color::RED
color.alpha = 5


Gosu prevents changes to colour constants, but this is not documented and the error message is pretty misleading. The correct way to fix this is:

color = Gosu::Color::RED.dup
color.alpha = 5
Up Topic Gosu / Gosu Exchange / StickBall how to correct alpha with current Gosu version?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill