Ruby-gnome2 and simple games

Hello,

as I am currently doing some small games (ruby-gnome2
seems to allow a lot of needed things for small GUI
games), I have two questions:

a) In a Gtk::Canvas, is there a way to retrieve the current
position of its elements and groups (for example,
a Gtk::CanvasRect that was moved)?

I am asking because you can move such an element with the
cursor keys using events and .move().
But I have found no easy way to find out the positional
information of this CanvasRect after you move() it around
a bit.

I could work around this by using positional variables,
which get changed whenever .move() is invoked, but i
was hoping this would already be supplied somewhere from
Gtk::Canvas or CanvasRect to answer a question such as
“Where is my box?”.
(Docu of CanvasRect and most other Canvas* is missing by
the way)

b) This also leads me to the next question:

How would i find out of a CanvasRect “touches” the border
of a Canvas? Right now my moving box can scroll out of
the canvas, and I want to disallow this. I want to
create an example Snake/Worms game, where the worm gets
larger when he eats something, and dies when he touches
the border.

Thanks for all the help so far by the way!


Get your free email from http://www.linuxmail.org

Powered by Outblaze


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642