Skip to main content

Posts

Showing posts from January, 2008

Rails and ActiveScaffold problems

It appears that form_tag :action => 'show_results' is not the same as form_tag 'show_results' . Always use form_tag :action => 'show_results' . Also, when you get strange errors from RJS that ActiveScaffold hide method does not exists, you may need to download the latest version of ActiveScaffold and make sure that the Public folder (where the javascript files are stored) and the Vendor folder (where the plugin is stored) gets updated with that new version.

My first work with Gosu + Chipmunk

I modified the tutorial game to make the ship point to the mouse cursor. Kept the physics, resulting in an interesting game. Here is the source code: require 'rubygems' require 'gosu' require 'chipmunk' SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 # The number of steps to process every Gosu update # The Player ship can get going so fast as to "move through" a # star without triggering a collision; an increased number of # Chipmunk step calls per update will effectively avoid this issue SUBSTEPS = 6 # Convenience methods for converting between Gosu degrees, radians, and Vec2 vectors class Numeric def gosu_to_radians (self - 90) * Math::PI / 180.0 end def radians_to_gosu self * 180.0 / Math::PI + 90 end def radians_to_vec2 CP::Vec2.new(Math::cos(self), Math::sin(self)) end end # Layering of sprites module ZOrder Background, Stars, Player, UI, Cursor = *0..4 end class Cursor attr_reader :img, :visible, :imgObj, :p

Gosu, Chipmunk in Ubuntu linux

To use the excellent ruby game framework Gosu and the 2D physics engine Chipmunk in Ubuntu, you need to copy the two .so files (chipmunk.so and gosu.so) in the /lib/ruby/1.8/i686-linux folder. You can download those files from  https://sites.google.com/site/jptarqu/downloads  (look for  gosu_and_chipmunk.tar.bz2) . I will explore the possibility of cross-platform, easy Game development using Gosu.