RPGVX.net
RPG-Maker VX => VX Technik [Frageforum] => Thema gestartet von: linhtendo 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
-
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
-
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!