Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Forum
Search
Topic Turn Based Game By noahc Date 2016-02-05 00:35
I should have been clear. I'm already doing what you suggest. However, when I press the key and let go the first player is moving (left for example) the game is switching state and the next player is moving left. So the two robots are essentially following each other around because it is happening too fast.

How can I make sure that the button is released before a new input button is allowed is what I'm really asking or what I really need, right?
Topic Turn Based Game By noahc Date 2016-02-04 01:29
I'm not sure how best to approach this or even how to get started. I have two player objects. And they are both drawn on the board. When I press the arrow keys one player moves.

However, I want to do two things:

1. Limit input to only 'one move' at time. What I mean by that is sometimes I can't get off the key press fast enough the the player jumps more than one space in whatever direction I'm pushing down the arrow key in.
2. This is probably pretty easy depending on what the above looks like, but I'd like to switch players after receiving the first key input to the other player. Maybe creating an 'active_player' to receive the method call on.

Any thoughts on how best to approach this or how to do it?
Topic Cannot open file ruby.png By noahc Date 2015-12-18 20:16
Resolved: http://stackoverflow.com/questions/34362487/cannot-open-file-ruby-png-in-gosu-using-learn-game-programming-with-ruby/34362815#34362815

Solution: Don't be an idiot!
Topic Cannot open file ruby.png By noahc Date 2015-12-18 19:32
I'm working through the learn game programming book by pragmatic programmers and I can't even manage to get the sample code running. I've dowloaded and when I try to run it, I see the following....

❯ ruby WhackARuby/WhackARuby_1/whack_a_ruby.rb                                                                                                                                                                                         
/Users/noahclark/.rvm/gems/ruby-2.2.3@beancounter/gems/gosu-0.10.4/lib/gosu/patches.rb:40:in initialize': Cannot open file ruby.png (RuntimeError)
  from /Users/noahclark/.rvm/gems/ruby-2.2.3@beancounter/gems/gosu-0.10.4/lib/gosu/patches.rb:40:in
initialize'
  from WhackARuby/WhackARuby_1/whack_a_ruby.rb:15:in new'
  from WhackARuby/WhackARuby_1/whack_a_ruby.rb:15:in
initialize'
  from WhackARuby/WhackARuby_1/whack_a_ruby.rb:70:in new'
  from WhackARuby/WhackARuby_1/whack_a_ruby.rb:70:in
<main>'

This is the offending line: @image = Gosu::Image.new('ruby.png')

And I tried changing it to @image = Gosu::Image.new('./ruby.png') but that didn't help.  Any thought son what might be causing this?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill