collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Problem mit 'nem kleinen Script für TitelScreen  (Gelesen 765 mal)

Offline linhtendo

  • Ralph
  • *
  • Beiträge: 11
Problem mit 'nem kleinen Script für TitelScreen
« am: Dezember 13, 2010, 20:08:52 »
Hallo erstmal :D

Also, ich habe ein kleines Problem bei 'nem Script ... Also, erstmal hier der Code:
class MoveFactor
  attr_accessor :x
  attr_accessor :y
  attr_accessor :dx
  attr_accessor :dy
  def initialize
    @x = @y = @dx = @dy = 0
  end
end


#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Title Graphic
  #--------------------------------------------------------------------------
  alias animtitle_create_title_gfx create_title_graphic
  def create_title_graphic
    animtitle_create_title_gfx
    @spr_max = 16
    @sprite_table = Array.new(@spr_max)
    @move_table = Array.new(@spr_max)
    for i in 0...@spr_max
      spr = Sprite.new
      spr.bitmap = Cache.picture("bubble")
      spr.blend_type = 0
      spr.ox = spr.bitmap.width/2
      spr.oy = spr.bitmap.height/2
      mf = MoveFactor.new
      @move_table[i] = mf
      @sprite_table[i] = spr
      randomize_spr (i)
    end
  end
 
  def randomize_spr (i)
      mf = @move_table[i]
      spr = @sprite_table[i]
      spr.x = rand(544)
      spr.y = 416 + rand(416)
      spr.zoom_x = spr.zoom_y = (rand(24)+25)/48.0
      spr.z = 50 + spr.zoom_x * 20
      spr.opacity = spr.zoom_x*255
      mf.x = spr.x*256
      mf.y = spr.y*256
      mf.dx = 0
      mf.dy = -spr.height*spr.zoom_y*3
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias animtitle_update update
  def update
    for i in 0...@spr_max
      mf = @move_table[i]
      spr = @sprite_table[i]
      if(spr.y<-64)
        randomize_spr (i)
      else
        mf.dx += (8-rand(17))*spr.zoom_x
        spr.angle += mf.dx/spr.zoom_x/32
        mf.x += mf.dx
        mf.y += mf.dy
        spr.x = mf.x/256
        spr.y = mf.y/256
      end
    end
    animtitle_update
  end
end

Mein Problem ist jetzt, wenn ich im Titelbild bin und ein Spiel lade oder ein neues öffne, bleiben die Kugelchen. XD Also habe ich die ständig auf dem Screen. (Sie bewegen sich allerdings nicht)

Meine Frage ist jetzt: Was fehlt in dem Code, damit die Kugeln verschwinden, wenn ein Spiel geöffnet wird? ;_;
Ich hätte nämlich schon gerne dieses Script... Ich finds so schön ._.

Ich hoffe, ihr könnt mir irgendwie helfen :'D

Re: Problem mit 'nem kleinen Script für TitelScreen

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Problem mit 'nem kleinen Script für TitelScreen
« Antwort #1 am: Dezember 13, 2010, 21:11:45 »
Probiers mal damit. ^^
class MoveFactor
  attr_accessor :x
  attr_accessor :y
  attr_accessor :dx
  attr_accessor :dy
  def initialize
    @x = @y = @dx = @dy = 0
  end
end
 
 
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================
 
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Title Graphic
  #--------------------------------------------------------------------------
  alias animtitle_create_title_gfx create_title_graphic
  def create_title_graphic
    animtitle_create_title_gfx
    @spr_max = 16
    @sprite_table = Array.new(@spr_max)
    @move_table = Array.new(@spr_max)
    for i in 0...@spr_max
      spr = Sprite.new
      spr.bitmap = Cache.picture("bubble")
      spr.blend_type = 0
      spr.ox = spr.bitmap.width/2
      spr.oy = spr.bitmap.height/2
      mf = MoveFactor.new
      @move_table[i] = mf
      @sprite_table[i] = spr
      randomize_spr (i)
    end
  end
   
  def randomize_spr (i)
      mf = @move_table[i]
      spr = @sprite_table[i]
      spr.x = rand(544)
      spr.y = 416 + rand(416)
      spr.zoom_x = spr.zoom_y = (rand(24)+25)/48.0
      spr.z = 50 + spr.zoom_x * 20
      spr.opacity = spr.zoom_x*255
      mf.x = spr.x*256
      mf.y = spr.y*256
      mf.dx = 0
      mf.dy = -spr.height*spr.zoom_y*3
  end
   
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias animtitle_update update
  def update
    for i in 0...@spr_max
      mf = @move_table[i]
      spr = @sprite_table[i]
      if(spr.y<-64)
        randomize_spr (i)
      else
        mf.dx += (8-rand(17))*spr.zoom_x
        spr.angle += mf.dx/spr.zoom_x/32
        mf.x += mf.dx
        mf.y += mf.dy
        spr.x = mf.x/256
        spr.y = mf.y/256
      end
    end
    animtitle_update
  end
  alias terminate_delete_bubbles terminate unless $@
  def terminate
    terminate_delete_bubbles
    for bubble in @sprite_table
       bubble.dispose
    end
  end
end



Re: Problem mit 'nem kleinen Script für TitelScreen

Offline linhtendo

  • Ralph
  • *
  • Beiträge: 11
Re: Problem mit 'nem kleinen Script für TitelScreen
« Antwort #2 am: Dezember 13, 2010, 22:38:47 »
OH VIELEN DANK :D! Ich muss das auch mal lernen, ey... Dann könnt ich sowas auch alleine hinkriegen. ;_; Aber naja.. Faulheit.

Danke nochmal. <3 Hat geholfen!

 


 Bild des Monats

rooftop party

Views: 3615
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal