Phil Cooper-king wrote:
> Thanks guys.
> 
> the Gosu::Window thing would that be an example of nested then? as in 
> Gosu module Window class?

Yes.

> the deleting instance var object was something that I was trying to do 
> in regards to Gosu Game lib.
> it tries to update itself 60 times a second, so if you press a key it 
> gets regstered by the lib several times. I was trying to create a method 
> that it would once the key was pressed it remained inactive for a set 
> time. I was using the Gosu::milliseconds for this. it seemed easier to 
> create a class that handled this, and I was getting worried that it 
> would create loads of objects that only had a short life span then 
> sucked up perfomance as the game continued. but if they delete them self 
> if there is no pointer to them that works.

In your key handling method, wrap the logic in something like
if not @pause_end or Gosu::milliseconds > @pause_end
  # ...
end

After you handle whatever key was pressed, just add a line like:

@pause_end = Gosu::milliseconds + 500 # or however long you want it to 
be inactive





-- 
Posted via http://www.ruby-forum.com/.