Changeset 20368

Show
Ignore:
Timestamp:
10/01/08 16:38:25 (3 months ago)
Author:
authorNari
Message:

add method state to Life

Location:
lang/ruby/nario/nario
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/nario/nario/life.rb

    r20294 r20368  
    7474    end 
    7575 
     76    def state 
     77      "x->#{@x} y->#{@y}" 
     78    end 
     79 
    7680    def head_range 
    7781      {:x_range => (@x+@w/6)..(@x+@w-@w/6), :y_range => @y..(@y+@h/6), :event => ("collide_#{extract_class_name(self)}_head".to_sym)} 
     
    106110    alias collide_pipe_left collide_floor_left 
    107111    alias collide_pipe_right collide_floor_right 
    108  
    109112 
    110113    private 
  • lang/ruby/nario/nario/life/nario.rb

    r20294 r20368  
    155155      @y = w.y + w.h + 5 
    156156    end 
     157 
     158    def state 
     159      "x=#{@x} y=#{@y} dash_speed=#{@dash_speed} jump?#{@is_jumpping} fly?#{@is_fly} goal?#{@is_goal}" 
     160    end 
    157161  end 
    158162end 
  • lang/ruby/nario/nario/scene/flowworld.rb

    r20294 r20368  
    1717    def render(screen) 
    1818      @renders.each{|re| re.each{|o| o.put_screen(screen) if o.x < SCREEN_WIDTH } } 
    19       puts "player: x -> #{@player.x} y -> #{@player.y}" if $DEBUG_PLAYER_WATCH_MODE 
     19      puts "player: #{@player.state}" if $DEBUG_PLAYER_WATCH_MODE 
    2020      @player.put_screen(screen) 
    2121    end