Commit b57aae3d9e65411711f9e16a8c78447b21aafd09

Authored by Marius Hanne
1 parent f436d8bf8b
Exists in master

handle explosions without chipmunk, to prevent weird hangs

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

... ... @@ -2,12 +2,16 @@
2 2  
3 3 include Rubygame
4 4  
5   - DEFAULTS = { image: "explosion.png", zoom: 0.5, sound: "explosion.wav", volume: 0.5, ctype: :explosion}
  5 + DEFAULTS = { image: "explosion.png", zoom: 0.5, rot: 0.0, sound: "explosion.wav", volume: 0.5, ctype: :explosion}
6 6  
7 7 attr_accessor :image, :size
8 8 def initialize game, opts = {}, &block
9 9 opts = DEFAULTS.merge(opts)
10   - super(game, opts)
  10 + @game, @options = game, DEFAULTS.merge(opts)
  11 + @surface = Surface.load(File.join(@game.data_dir, "images", @options[:image]))
  12 + .rotozoom(@options[:rot], @options[:zoom]).to_display_alpha
  13 + @image = @surface
  14 +
11 15 @frame = 0
12 16 @block = block
13 17 @length = 20
... ... @@ -21,7 +25,7 @@
21 25 def draw screen
22 26 destroy if @frame >= @length - 2
23 27 s = @surface.zoom(options[:zoom])
24   - s.blit(screen, pos.sub(s.size.div(2)))
  28 + s.blit(screen, options[:p].sub(s.size.div(2)))
25 29 options[:zoom] += 0.025
26 30 @frame += 1
27 31 end