2 oder mehr Animationen auf einmal anzeigen
Hi!
Im Maker ist es ja so, dass man im Grunde auf jedes Event eine Animation zur selben Zeit anzeigen kann. Die Betonung liegt auf eine ... denn 2 oder mehr Animation sind nicht möglich bzw. schon, nur wird halt nur eine davon angezeigt. Ich benötige aber die Möglichkeit, dass ich 2 oder mehr ANimationen auf einem Event (Spieler natürlich auch) anzeigen kann ...
Ich hoffe, ein Skripter kann sich das mal anschauen und sowas zusammenbasteln =).
thx & greetz
Im Maker ist es ja so, dass man im Grunde auf jedes Event eine Animation zur selben Zeit anzeigen kann. Die Betonung liegt auf eine ... denn 2 oder mehr Animation sind nicht möglich bzw. schon, nur wird halt nur eine davon angezeigt. Ich benötige aber die Möglichkeit, dass ich 2 oder mehr ANimationen auf einem Event (Spieler natürlich auch) anzeigen kann ...
Ich hoffe, ein Skripter kann sich das mal anschauen und sowas zusammenbasteln =).
thx & greetz
Skripte:
Animations "Entruckler"
Console
Drunken Mode
Eventskript Debugger
Flat-Events
Impassable Script
Item Shortcut
MSS: Monsta's Shoot System (Neu)
Radius Skript
Random Event Teleport
RMXP Leistungstest
Single Rotate
Split Screen (Beta)
Tutorials:
'alias' Bug beheben
Eigenes RTP
Standard KS komplett Übersetzen
RGSS: Eigener HUD
Programme:
Maker Exchange [ MEX ]
RMXP Skript Explorer
RPGXP Code Converter
Spiele:
[Minispiel] Stampfi V1.5 (Gold)
[Minispiel] Mastermind XP
[Humor] Verfressene Klone
______________________________
[Zukunft] Evil Science
zum Lesen den Text mit der Maus markieren
Haha ...
Das kenne ich ... habs aber net erwähnt da
1. Es nicht ganz für mich ersichtlich ist ob man damit nun nur an beliebigen Stellen Anis zeigen kann oder aber auch mehrere gleichzeitig an der selben Posi, sprich ein Event oder Spieler.
2. Der Link nicht funzt.
EDIT:
Okay .. ich hab in den weiten der Foren das Skript gefunden, leider keine Demo. Das ist auch das Problem .. ich kapiers nicht ... meine Unfähigkeit ist untröstlich -.-.
Hier das Skript
Ich komm nicht mit der Anwendung klar. Laut Anleitung Sieht der Befehl so aus
Ich möchte die Animation auf dem Player anzeigen lassen, laut Anleitung muss ich bei type 'screen' oder 1 bei type einsetzen. Die Sachen im [ ] sind optional, ich möchte sie nicht, also werden sie weg gelassen. Nun habe ich das hier:
Die 93 ist die Animation ID. Was soll ich jetzt mit x und y anstellen? Dazu ist bei Type 1 nichts angegeben. Weg lassen bringt ne Fehlermeldung beim aufrufen, ebenso das stehen lassen. Ersetze ich x und y durch Zahlen, kommt auch ne Fehlermeldung -.-.
Kann mir vllt. jemand sagen, wie das Ding funktionieren soll?
EDIT²:
Hat sich erledigt ..
greetz
Das kenne ich ... habs aber net erwähnt da
1. Es nicht ganz für mich ersichtlich ist ob man damit nun nur an beliebigen Stellen Anis zeigen kann oder aber auch mehrere gleichzeitig an der selben Posi, sprich ein Event oder Spieler.
2. Der Link nicht funzt.
EDIT:
Okay .. ich hab in den weiten der Foren das Skript gefunden, leider keine Demo. Das ist auch das Problem .. ich kapiers nicht ... meine Unfähigkeit ist untröstlich -.-.
Hier das Skript
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
=begin
┌──────────────────────────────────────┐
│● Display Animations 2.0 │
│ │
│ Created By │
│ │
│ Trickster (tricksterguy@hotmail.com)│
│ │
│ │
└──────────────────────────────────────┘
►Intro
This script will allow you to display an animation at any (x,y) position or
any tile so you will not have to use blank events to display an animation at
that tile
►Instructions
Add this above main.
Calling
$animations.push(Animation.new(type,x,y,id[,loop,sound,viewport]))
anything within the [] is optional
type is the type of animation use either 1,2,3 or 'screen','tile','map'
1 or 'screen' follows the player it stays on the screen
2 or 'tile' stays at a particular tile (x,y)
3 or 'map' stays at a particular position (x,y) on the map
4 or 'player' follows the player (x,y) defines the offset
5 or 'event' follows an event (use x parameter for id and [x,y] for offset)
id is the animation id to play
Optional
loop is the number of times to play the animation
set this to nil an the animation plays forever
the default value is 1
sound set to true and you will hear the animation's sounds
set this to false and the sounds will not play
the default value is true
viewport is the animations viewport the default is the whole screen
=end
#==============================================================================
# ** Animation
#------------------------------------------------------------------------------
# This class displays an animation, it can be displayed at any (x,y) rather than
# using the show animation event command and being restricted to displaying it
# on an event.
#==============================================================================
class Animation
#--------------------------------------------------------------------------
# * Static (Class) Variables
#--------------------------------------------------------------------------
@@animations = []
@@reference_count = {}
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :x
attr_accessor :y
attr_accessor :z
attr_accessor :ox
attr_accessor :oy
attr_accessor :loop
attr_accessor :sound
attr_accessor :flash
attr_accessor :hit
attr_accessor :viewport
attr_accessor :visible
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(type, x, y, id, loop = 1, sound = true, flash = true, hit = true,
viewport = nil)
# Setup Type of Animation Display
@type = type
# Initialize Offset X and Offset Y and Z
@ox, @oy, @z = 0,0,2000
# Set Visiblility to true
@visible = true
# Branch Out According to Type
case type
when 'screen','map',1,3
# When Screen or Map or 1 or 3 Set X and Y to given coordinates
@x, @y = x, y
when 'tile',2
# When Tile or 2 Set X and Y to real coordinates
# Convert Tile coordinates to Screen coordinates
@x, @y = (x % $game_map.width) * 128, (y % $game_map.height) * 128
when 'player',4
# When Player or 4 Set Offset X and Y to Coordinates Given
@battler = $game_player
@ox, @oy = x, y
when 'event',5
# When Event or 5 Set Offset X and Y to The Y Given (An Array)
@battler = $game_map.events[x]
@ox, @oy = *y
end
# Get Animation
@animation = $data_animations[id]
# If animation is nil then return
return if @animation.nil?
# Initialize looping sound and viewport
@loop, @sound, @viewport = loop, sound, viewport
# If there is no battler then hit is false
@hit = @battler == nil ? false : hit
# Initialize Animation
animation
end
#--------------------------------------------------------------------------
# * Animation Initialize
#--------------------------------------------------------------------------
def animation
# Dispose any old Animation
dispose_animation
# Setup Duration
@animation_duration = @animation.frame_max
# Get Animation Name and Hue
animation_name = @animation.animation_name
animation_hue = @animation.animation_hue
# Get Animation Bitmap
bitmap = RPG::Cache.animation(animation_name, animation_hue)
# Increase or Setup Reference Count for Bitmap
if @@reference_count.include?(bitmap)
@@reference_count[bitmap] += 1
else
@@reference_count[bitmap] = 1
end
# Setup Animation Sprites
@animation_sprites = []
# Prevent Duplicate Screen Animations from being played
if @animation.position != 3 or not @@animations.include?(@animation)
16.times do |i|
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@animation_sprites[i] = sprite
end
@@animations << @animation unless @@animations.include?(@animation)
end
# Update Animation
update_animation
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# If Animation is not equal to nil and 2 frames has passed
if @animation != nil and (Graphics.frame_count % 2 == 0)
# Decrease Duration
@animation_duration -= 1
# Update animation
update_animation
end
# Clear Animations
@@animations.clear
end
#--------------------------------------------------------------------------
# * Update Animation
#--------------------------------------------------------------------------
def update_animation
# If Duration is Greater than zero or Indefinite Loop Or Looping
if @animation_duration > 0 or @loop.nil? or @loop > 1
# If Duration is Zero (For Looping)
if @animation_duration == 0
# Reset Animation Duration and Decrease Loops if not an Indefinite Loop
@animation_duration = @animation.frame_max
@loop -= 1 if !@loop.nil?
end
# Get Frame Index cell_data and position
frame_index = @animation.frame_max - @animation_duration
cell_data = @animation.frames[frame_index].cell_data
position = @animation.position
# Set Sprites for animation
animation_set_sprites(@animation_sprites, cell_data, position)
# Check Each Timing If at that frame then there is something that needs to
# Be done (Flash, Sound, etc..)
@animation.timings.each do |timing|
animation_process_timing(timing) if timing.frame == frame_index
end
else
# Dispose Animation
dispose_animation
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
dispose_animation
end
#--------------------------------------------------------------------------
# * Dispose Animation
#--------------------------------------------------------------------------
def dispose_animation
# Skip unless animations sprites is not nil (Array) and its not empty
return unless @animation_sprites != nil and not @animation_sprites.empty?
# Get a Sprite, Reduce Reference count, Dispose the bitmap if references
# are zero
sprite = @animation_sprites[0]
@@reference_count[sprite.bitmap] -= 1
sprite.bitmap.dispose if @@reference_count[sprite.bitmap] == 0
# Dispose Each Sprite
@animation_sprites.each {|sprite| sprite.dispose}
@animation_sprites.clear
@animation = nil
@disposed = true
end
#--------------------------------------------------------------------------
# * Disposed?
#--------------------------------------------------------------------------
def disposed?
return @disposed.nil? ? false : true
end
#--------------------------------------------------------------------------
# * Animation Set Sprites
#--------------------------------------------------------------------------
def animation_set_sprites(sprites, cell_data, position)
16.times do |i|
# Get Sprite and Pattern
sprite = sprites[i]
pattern = cell_data[i, 0]
# If Sprite is nil or Pattern is nil or -1
if sprite == nil or pattern == nil or pattern == -1
# Set Visibility to false unless sprite is nil
sprite.visible = false if sprite != nil
# Continue to Next Iteration
next
end
# Set Visibility
sprite.visible = self.visible
# Setup Source Rectangle
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
# Branch According to Type
case @type
when 'tile','map',2,3
sprite.x = (self.x - $game_map.display_x + 3) / 4 + 16
sprite.y = (self.y - $game_map.display_y + 3) / 4 + 32
when 'screen',1
sprite.x = self.x
sprite.y = self.y
when 'player','event',4,5
sprite.x = @battler.screen_x + self.ox
sprite.y = @battler.screen_y + self.oy
end
# Increase X and Y depending on position placed
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
# Setup Z to Z of the animation (Def. 2000)
sprite.z = self.z
# Setup Sprite's Offset X and Y
sprite.ox = 96
sprite.oy = 96
# Setup Other Properties
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6]
sprite.blend_type = cell_data[i, 7]
end
end
#--------------------------------------------------------------------------
# * Animation Process Timing
#--------------------------------------------------------------------------
def animation_process_timing(timing)
# If Sound Enabled and Timing Sound Effect name is not an empty string
if timing.se.name != "" and self.sound
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
return if not hit
# IF Current Scene is Scene_Map and Battler is not nil
if $scene.is_a?(Scene_Map) and @battler != nil
# Find the character
character = $scene.spriteset.find_character(@battler)
end
return if character == nil
# Branch our according to Flash Scope
case timing.flash_scope
when 1
# Flash the Character
character.flash(timing.flash_color, timing.flash_duration * 2)
when 2
# Flash the Characters Viewport
if character.viewport != nil
character.viewport.flash(timing.flash_color, timing.flash_duration * 2)
end
when 3
# Make the Character Invisible
character.flash(nil, timing.flash_duration * 2)
end
end
#--------------------------------------------------------------------------
# * Set X Coordinate
#--------------------------------------------------------------------------
def x=(x)
sx = @battler == nil ? x : x - @battler.screen_x
if sx != 0 and @animation_sprites != nil
@animation_sprites.each {|sprite| sprite.x += sx}
end
@x = sx
end
#--------------------------------------------------------------------------
# * Set Y Coordinate
#--------------------------------------------------------------------------
def y=(y)
sy = @battler == nil ? y : y - @battler.screen_y
if sy != 0 and @animation_sprites != nil
@animation_sprites.each {|sprite| sprite.y += sy}
end
@y = sy
end
end
class Scene_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :spriteset
end
class Spriteset_Map
#--------------------------------------------------------------------------
# * Find Character
#--------------------------------------------------------------------------
def find_character(char)
@character_sprites.each do |character|
return character if character.character == char
end
end
end |
zum Lesen den Text mit der Maus markieren
Ich komm nicht mit der Anwendung klar. Laut Anleitung Sieht der Befehl so aus
|
|
Quellcode |
1 |
$animations.push(Animation.new(type,x,y,id[,loop,sound,viewport])) |
Ich möchte die Animation auf dem Player anzeigen lassen, laut Anleitung muss ich bei type 'screen' oder 1 bei type einsetzen. Die Sachen im [ ] sind optional, ich möchte sie nicht, also werden sie weg gelassen. Nun habe ich das hier:
|
|
Quellcode |
1 |
$animations.push(Animation.new(1, x, y, 93)) |
Die 93 ist die Animation ID. Was soll ich jetzt mit x und y anstellen? Dazu ist bei Type 1 nichts angegeben. Weg lassen bringt ne Fehlermeldung beim aufrufen, ebenso das stehen lassen. Ersetze ich x und y durch Zahlen, kommt auch ne Fehlermeldung -.-.
Kann mir vllt. jemand sagen, wie das Ding funktionieren soll?
EDIT²:
Hat sich erledigt ..
greetz
Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von »schmoggi« (29. Dezember 2008, 15:24)
Ich wollte jetzt kein neues Thema eröffnen deshalb schreib ich es einfach mal hier rein ...
Problem ist folgendes:
Ich nutze dieses Skript hier (ein Auszug aus der RPG::Sprite) um den Z Wert von Animationen auf den des Spieler anzupassen, sprich Animationen werden nicht mehr über alles (Bäume etc.) angezeigt.
DerBereich mit "# EDIT #" ist der editierte (by Monsta) und ich habs halt für mich angepasst. So sind die ersten 200 Anis auf dem selben Z Wert wie der Spieler, die restlichen sind standard (2000). Funktioniert auch alles schön.
Jedoch habe ich ja jetzt das Skript (oben) um Anis mehrmals anzeigen zu können etc. In diesem Skript wird allerdings nochmal selber der Z Wert festgelegt ... im endeffekt sieht es so aus:
Animationen, die ich über SHow Animation anzeigen lasse, haben den Z Wert vom Spieler.
Animationen, die ich über das neue Skript anzeigen lasse, haben den standard Z Wert (2000) und werden somit über alles angezeigt.
Ich möchte aber, dass die Anis, welche über das Skript aufgerufen werden, auch den Z Wert vom Spieler haben.
Ich hab mich mal selbst versucht aber ich hab ja ka von und es dementsprechend net geschafft xD.
Hoffe, jmd kann das irgendwie hinbekommen.
greetz
Problem ist folgendes:
Ich nutze dieses Skript hier (ein Auszug aus der RPG::Sprite) um den Z Wert von Animationen auf den des Spieler anzupassen, sprich Animationen werden nicht mehr über alles (Bäume etc.) angezeigt.
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
module RPG
class Sprite < ::Sprite
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x - self.ox + self.src_rect.width / 2
sprite.y = self.y - self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
#====EDIT====#
if @_animation.id.between?(1,200)
sprite.z = self.z
else
sprite.z = 2000
end
#====EDIT====#
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end |
zum Lesen den Text mit der Maus markieren
DerBereich mit "# EDIT #" ist der editierte (by Monsta) und ich habs halt für mich angepasst. So sind die ersten 200 Anis auf dem selben Z Wert wie der Spieler, die restlichen sind standard (2000). Funktioniert auch alles schön.
Jedoch habe ich ja jetzt das Skript (oben) um Anis mehrmals anzeigen zu können etc. In diesem Skript wird allerdings nochmal selber der Z Wert festgelegt ... im endeffekt sieht es so aus:
Animationen, die ich über SHow Animation anzeigen lasse, haben den Z Wert vom Spieler.
Animationen, die ich über das neue Skript anzeigen lasse, haben den standard Z Wert (2000) und werden somit über alles angezeigt.
Ich möchte aber, dass die Anis, welche über das Skript aufgerufen werden, auch den Z Wert vom Spieler haben.
Ich hab mich mal selbst versucht aber ich hab ja ka von und es dementsprechend net geschafft xD.
Hoffe, jmd kann das irgendwie hinbekommen.
greetz
Benutzerinformationen überspringen
Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.
Müsste dann eigentlich reichen, wenn du Zeile 250 löscht/auskommentierst. (also im oberen Skript)
Ach kommt schon Leute ...
...
Wenns zu schwer ist oder was weiß ich gäbs noch ne alternative:
Dieses Skript hier nennt sich Multiple Animations und erlaubt es, wie der Name schon vermuten lässt, mehrere Anis ganz normal über den event befehl anzuzeigen .. also sprich, genau das was ich will. Problem ist nur, dass es über die Animations im Standard KS läuft, also der Befehl show Battle Animation und nicht, was ich haben möchte, Show Animation (also auf der Map).
Wenn sich das jmd. anschauen und es vllt. umschreiben/anpassen könnte, so dass Show Animation auch funzt wäre das echt cool :-\ ...
auf rmxp.org meldet sich zurzeit auch niemand deshalb frag ich auch hier xD.
greetz
...Wenns zu schwer ist oder was weiß ich gäbs noch ne alternative:
Dieses Skript hier nennt sich Multiple Animations und erlaubt es, wie der Name schon vermuten lässt, mehrere Anis ganz normal über den event befehl anzuzeigen .. also sprich, genau das was ich will. Problem ist nur, dass es über die Animations im Standard KS läuft, also der Befehl show Battle Animation und nicht, was ich haben möchte, Show Animation (also auf der Map).
Wenn sich das jmd. anschauen und es vllt. umschreiben/anpassen könnte, so dass Show Animation auch funzt wäre das echt cool :-\ ...
auf rmxp.org meldet sich zurzeit auch niemand deshalb frag ich auch hier xD.
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
#==============================================================================
# ** Multiple Animations
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2007-03-06
# SDK : Version 2.0, Part 1
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2007-03-06)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to show multiple animation sprites at the same
# time. When an animation sprite is created, it is immediately added to an
# array of animation sprites. From there, each animation sprite is handeled
# the same way the default animation sprite is handeled. This also delays
# animations to prevent multiple damages being displayed at once.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Multiple Animations', 'SephirothSpawn', 1, '2007-03-06')
SDK.check_requirements(2, [1])
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Multiple Animations')
#==============================================================================
# ** RPG::Sprite
#==============================================================================
class RPG::Sprite < ::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @seph_multianim_stack.nil?
alias_method :seph_multianim_rpgs_init, :initialize
alias_method :seph_multianim_rpgs_disp, :dispose
alias_method :seph_multianim_rpgs_updt, :update
@seph_multianim_stack = true
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(viewport = nil)
# Original Initialization
seph_multianim_rpgs_init(viewport)
# Create Animation Sprite Array
@_multi_animation_sprites = []
@_multi_animation_duration = []
@_multi_animation_data = []
# Damage Delay Count
@_animations_delay_count = 0
@_animations_pops_coming = []
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Original Dispose
seph_multianim_rpgs_disp
# Pass Through Multi-Animations Sprites
@_multi_animation_duration.size.times { dispose_multi_animations }
end
#--------------------------------------------------------------------------
# * Dispose Multi Animations
#--------------------------------------------------------------------------
def dispose_multi_animations(index = 0)
# Get Sprites
sprites = @_multi_animation_sprites[index]
# If Non-nil sprites
unless sprites.nil?
# Get First Sprite
sprite = sprites[0]
unless sprite.nil?
@@_reference_count[sprite.bitmap] -= 1
sprite.bitmap.dispose if @@_reference_count[sprite.bitmap] == 0
end
for sprite in sprites
sprite.dispose
end
@_multi_animation_sprites[index] = nil
@_multi_animation_duration[index] = 0
@_multi_animation_data[index] = []
end
end
#--------------------------------------------------------------------------
# * Animation
#--------------------------------------------------------------------------
def animation(animation, hit)
# Adds Animation to Pop List
unless animation.nil? && hit.nil?
@_animations_pops_coming << [animation, hit]
end
# Return If Animation Delay
return if @_animations_delay_count > 0
# Start Animation Count
@_animations_delay_count = 8
# Gets Pops Coming
animation, hit = *@_animations_pops_coming.shift
# Return if Nil Animation
return if animation.nil?
# Sets Animation & Hit Data
@_multi_animation_data << [animation, hit]
# Set Animation Duration
@_multi_animation_duration << animation.frame_max
# Create Sprites
animation_name = animation.animation_name
animation_hue = animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
@@_reference_count[bitmap] = 0 unless @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
sprites = []
if animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap, sprite.visible = bitmap, false
sprites.push(sprite)
end
end
# Add Animation Sprites
@_multi_animation_sprites << sprites
# Update Multi Animation
update_multi_animation(@_multi_animation_data.size - 1)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Animation Delaying
if @_animations_delay_count > 0
@_animations_delay_count -= 1
# If Animation Not Delaying
else
# If Animation Waiting to Be Popped
if @_animations_pops_coming.size > 0
# Create Animation Sprite
animation(nil, nil)
end
end
# Original Update
seph_multianim_rpgs_updt
# If Animation Sprites Exist & Frame Reset
if @_multi_animation_duration.size > 0 && Graphics.frame_count % 2 == 0
# Update Multi-animations
update_multi_animations
end
end
#--------------------------------------------------------------------------
# * Frame Update : Multi-Animations
#--------------------------------------------------------------------------
def update_multi_animations
# Pass Through All Animation Data
for i in 0...@_multi_animation_duration.size
# Decrease Animation Duration
@_multi_animation_duration[i] -= 1 rescue p @_multi_animation_duration, i
# Update Multi Animation
update_multi_animation(i)
end
# Deletes Nil Elements
for index in 0...@_multi_animation_duration.size
if @_multi_animation_sprites[index].nil? &&
@_multi_animation_duration[index] == 0 &&
@_multi_animation_data[index] == []
@_multi_animation_sprites.delete_at(index)
@_multi_animation_duration.delete_at(index)
@_multi_animation_data.delete_at(index)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Multi-Animation
#--------------------------------------------------------------------------
def update_multi_animation(i = 0)
# If Duraction Greater Than 0
if @_multi_animation_duration[i] > 0
# Get Animation Data
anim, hit = *@_multi_animation_data[i]
# Get Sprites, Cell Data & Position
sprites = @_multi_animation_sprites[i]
frame_index = anim.frame_max - @_multi_animation_duration[i]
cell_data = anim.frames[frame_index].cell_data
position = anim.position
# Processes Animation Sprites
animation_set_sprites(sprites, cell_data, position)
# Pass Through Timings
for timing in anim.timings
# If Frame Index
if timing.frame == frame_index
# Processing Animation Timing
animation_process_timing(timing, hit)
end
end
# If 0 Duration
else
dispose_multi_animations(i)
end
end
end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end |
zum Lesen den Text mit der Maus markieren
greetz
Bump ...
Es wäre mir übrigens doch lieber, wenn das Skript von Seph angepasst wird anstatt das Animations Skript zu nutzen (somit gibts weniger rgss zeugs für mich).
EDIT:
Hat sich (endgültig) erledigt =).
greetz
Es wäre mir übrigens doch lieber, wenn das Skript von Seph angepasst wird anstatt das Animations Skript zu nutzen (somit gibts weniger rgss zeugs für mich).
EDIT:
Hat sich (endgültig) erledigt =).
greetz
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »schmoggi« (6. Januar 2009, 16:14)
Ähnliche Themen
-
RGSS 1 Probleme & Talk »-
Mehr Bilder auf einmal anzeigen können ??
(8. März 2008, 17:15)
-
Einsteigerhilfe »-
!,...,? auf dem kopf
(23. Januar 2008, 18:59)
-
Andere Maker »-
Mondlichts Kinder - Harvest Moon -
(24. April 2006, 19:32)
-
Events & Technik »-
Halbtransparenz der Animationen umstellen
(1. April 2006, 10:28)
-
Eventtechnik Archiv »-
Animationen transparent ?!
(2. August 2005, 11:30)

