「EFTX 20100417」の編集履歴(バックアップ)一覧はこちら

EFTX 20100417」(2010/04/17 (土) 12:42:39) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

require 'dxruby' module EFTX Image_Flash = Image.load("Image/flash.png") class Color < Array def initialize(a,b,c,d = nil) self.push a self.push b self.push c self.push d if d end def dark(value) result = [self[0]-value,self[1]-value,self[2]-value] result[0] = 0 if result[0] < 0 result[1] = 0 if result[1] < 0 result[2] = 0 if result[2] < 0 return result end def light(value) result = [self[0]+value,self[1]+value,self[2]+value] result[0] = 255 if result[0] > 255 result[1] = 255 if result[1] > 255 result[2] = 255 if result[2] > 255 return result end end @font = Font.new( 22,"",{:weight => true}) Lines = [] def self.set(text,x,y,style = {}) Lines.push Line.new(text,x,y,style) end def self.update Lines.compact! for i in 0..Lines.size next unless Lines[i] Lines[i].update Lines[i] = nil if Lines[i].phase == :diend end Window.drawFont(0,0,Lines.size.to_s,@font) Window.drawFont(0,32,Window.getLoad.to_s,@font) end class Line attr_accessor :phase def initialize(text,x,y,style) @phase = :appearing @sprites = [] @wait = 60 @wait = style[:wait] if style[:wait] @outwait = 6 @outwait = style[:outwait] if style[:outwait] color = Color.new(50,255,200) font = Font.new(12,"",{:weight => true }) image = Image.new(font.getWidth(text),font.size) image.drawFont(-1,-1,text,font,color.dark(160)) image.drawFont(-1,1,text,font,color.dark(160)) image.drawFont(1,-1,text,font,color.dark(160)) image.drawFont(1,1,text,font,color.dark(160)) image.drawFont(0,0,text,font,color.light(100)) ary = text.split(//) total_length = 0 for i in 0...ary.size case style[:indirection] when nil sx = x + rand(360)-180+total_length sy = y + rand(360)-180 when :up sx = x + total_length sy = 0 when :down sx = x + total_length sy = 480 when :left sx = 0 sy = y when :right sx = 640 sy = y when :fix sx = x + total_length sy = y when :rand4 case rand 4 when 0 sx = x + total_length sy = 0 when 1 sx = x + total_length sy = 480 when 2 sx = 0 sy = y when 3 sx = 640 sy = y end end delay = i * 16 delay = i * style[:inwait] if style[:inwait] @sprites.push EFTX::Character.new( image.slice(total_length,0,font.getWidth(ary[i]),font.size), sx, sy, x + total_length, y, style, delay ) total_length += font.getWidth(ary[i]) end end def update case @phase when :appearing comprete = true @sprites.each{|i| i.update comprete = false if i.phase != 2} @phase = :showing if comprete when :showing @sprites.each{|i|i.update} @wait -= 1 if @wait == 0 @phase = :disappering end when :disappering for i in 0..@sprites.size next unless @sprites[i] if @outwait > 0 @sprites[i].start_phase3 if @wait == - i * @outwait elsif @outwait < 0 @sprites[i].start_phase3 if @wait == (@sprites.size - i) * @outwait elsif @outwait == 0 @sprites[i].start_phase3 end @sprites[i].update @sprites[i] = nil if @sprites[i].phase == 4 end @phase = :diend if @sprites.compact.size == 0 @wait -= 1 end end end class Character attr_accessor :phase def initialize(image,x,y,dx,dy,style,delay) @x = x @y = y @dx = dx @dy = dy @image = image @spd = 6 @spd = style[:spd] if style[:spd] @phase = 0 @count = 0 @alpha = 5 @scalex = 0 @scaley = 0 @scalex = style[:inscale][0] if style[:inscale] @scaley = style[:inscale][1] if style[:inscale] @angle = 0 @style = style @delay = delay end def in_scale if @scalex > 1 @scalex *= 0.9 @scalex = 1 if @scalex < 1 else @scalex += 0.01 @scalex = 1 if @scalex > 1 end if @scaley > 1 @scaley *= 0.9 @scaley = 1 if @scaley < 1 else @scaley += 0.01 @scaley = 1 if @scaley > 1 end end def alpha_increase @alpha += 5 @alpha = 255 if @alpha > 255 end def update_phase0#待機フェイズ @phase = 1 if @count == @delay @count += 1 end def update_phase1 @spd *= 0.97 @spd = 1.5 if @spd < 1.5 if (@dx - @x).abs < @spd*2 and (@dy - @y).abs < @spd*2 and @scalex == 1 and @scaley == 1 @x = @dx @y = @dy start_phase2 Window.drawEx(@x-96,@y-96,Image_Flash,{:blend => :add,:z => 50}) @alpha = 255 @scalex = 1 @scaley = 1 #@angle = -30 else rad = Math.atan2(@dy - @y,@dx - @x) rotation = rad * 180 / Math::PI vx = Math.cos( rotation * Math::PI / 180 ) * @spd vy = Math.sin( rotation * Math::PI / 180 ) * @spd @x += vx @y += vy end in_scale alpha_increase #@angle += 30 end def start_phase2 @phase = 2 @reachtime = @count end def update_phase2 @count += 1 if @count - @reachtime < 26 Window.drawEx(@x,@y,@image,{:blend => :add , :z => 20 , :alpha => 255 - (@reachtime - @count) * 5}) Window.drawEx(@x-96,@y-96+8,Image_Flash,{:angle => rand(180), :scalex => 0.3 ,:scaley => (26 - (@count - @reachtime)) * 0.1, :blend => :add,:z => 0,:alpha => 255 - (@reachtime - @count * 10)}) end end def start_phase3 @dx = @x + rand(360) - 180 @dy = @y + rand(360) - 180 @phase = 3 end def update_phase3 if (@dx - @x).abs < @spd*2 and (@dy - @y).abs < @spd*2 @x = @dx @y = @dy @alpha = 0 @phase = 4 #Window.drawEx(@x-96,@y-96,Image_Flash,{:blend => :add,:z => 50}) else rad = Math.atan2(@dy - @y,@dx - @x) rotation = rad * 180 / Math::PI vx = Math.cos( rotation * Math::PI / 180 ) * @spd vy = Math.sin( rotation * Math::PI / 180 ) * @spd @x += vx @y += vy @alpha -= 5 @alpha = 0 if @alpha < 0 end end def update_phase4 end def update case @phase when 0 update_phase0 when 1 update_phase1 when 2 update_phase2 when 3 update_phase3 when 4 update_phase4 end Window.drawEx(@x,@y,@image,{:alpha => @alpha,:z => 0,:scalex => @scalex, :scaley => @scaley,#:blend => :add, :angle => @angle}) if @alpha > 20 end end end BG = Image.load "Image/BD8.jpeg" FONT = Font.new(16) image = Image.new(640,480) image.drawFont(100,100,"イベントホライゾン",FONT) #Window.magFilter=TEXF_GAUSSIANQUAD count = 0 Window.loop do #Window.draw(0,0,BG) EFTX.set("EFTX.set(\"\",100,240,nil)",100,240,{}) if count == 0 EFTX.set("嫌な診断つくってみた@AshDUmA", rand(550),rand(400),{:inwait => 8,:outwait => -6 ,:indirection => :rand4, :inscale => [0,0], }) if count % 120 == 0 EFTX.update unless Input.padDown? P_BUTTON0 Window.draw(50,150,image) count += 1 end

表示オプション

横に並べて表示:
変化行の前後のみ表示:
目安箱バナー