Window#update
when button_down? Gosu::KB_SPACE
, since 60 bullets per second are probably too many. Instead, you should have a counter variable like @reload_time
that you set to 30 when the player shoots, and then you decrement it every time update
is called, and only when it reaches 0, you create another projectile. Now the player can shoot twice per second, and it will feel much nicer than if Gosu would only update button_down?
every 500ms, because the first shot still happens immediately after pressing the button.t
between 0.0 and 1.0 as the "position" inside of the current transition. For example, if I wanted one screen to zoom in while another fades out, I would do this in draw
:def draw
t = position_in_transition() # 0.0...0.1
@previous_screen.draw
overlay_color = Gosu::Color.argb(t * 255, 0, 0, 0)
Gosu.draw_rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, overlay_color, 999999)
Gosu.scale(t) { @next_screen.draw }
end
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill