I wrote a little tool called [Pry](https://github.com/banister/pry/
) to help me in my game development.
It effectively opens up an IRB session on an object, letting you play with your runtime state, examine or modify it, and then, on typing 'exit' return you to your game.
Useful for debugging or implementing a quake-style console for your game.
Install the gem:
gem install pry
And try putting this somewhere in your update method:
Pry.into(self) if button_down?(Gosu::KbP)
Read the documentation here: https://github.com/banister/pry/
Very cool stuff, hopefully I'll have a good reason to play with this soon in a game.
Wow! I wish for this sort of thing fairly often, and now you've gone and done it. Thanks, good sir. :)
Improved Pry, and changed the API.
* Removed into() method (just use start())
* Added show_method command (retrieves sourcecode of a method)
* Added ls/cd commands (somehow they feel natural even though they're out of place)
But Pry.into() is so syntactically delicious!
No really, this looks quite nice. Should give it a try soon.
For some reason i didn't think of this before, but you can actually use Pry for hotswapping code:
Say you ask yourself: "lol i wonder what it would be like if i increased firing rate slightly, or if gravity was 3x as strong lmao?"
Process goes like this:
Start game, play for a while ---> Update code in editor, save changes --> enter a Pry session (i have it bound to keypress 'p') --> type load "my_updated_file.rb" --> exit pry (type 'exit')
Game then continues with the modifications applied. No restart necessary.
That is a very cool feature! I've been doing this for well over a year with SketchUp's Ruby console, and I also never made the connection :P
WTF, I actually just thought of hotswapping *today*.. ..and I just gave up on my google search, only to find this. Awesome.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill