How does the game split the graphics, like tilesets being 32 x 32...How does the game do it?? and what syntax would i use to do it??
Tilesets in RMXP are internally defined. Max width is 256, max height is any number dividable by 32. Autotiles are 96x128, animated autotiles are 384x128.
I know, I mean, to make an animated sprite of my own in a script...
>> I think I would have to have the game look for the bitmap, and set rect.new, and do block transfers, right??
Yeah.
Lol, got that much then...Now to figure out how to do it!! Haha
so u want tilesets to be animated?
wow.. thats cool
No, but thats a thought that I like!!
If you want an animated tileset, ...don't ask me, I don't know :/
If you want to animate, say, something like a character graphic (which has frames stacked together and you want to use those frames the way you like), you need a sprite,
@da_sprite = Sprite.new
You need to set the bitmap to the graphic
@da_sprite.bitmap = RPG::Cache.picture('Charset_experiment')
Then, you need to keep changing the source rectangle (src_rect) to suit your needs, like this:
@da_sprite.src_rect.set(x, y, w, h)
where x and y are the coordinates of the top-left corner of the required rectangle, w and h are also obvious. You might want to check the 'update' method of the class 'Arrow_Base' in the default scripts. There, the battle cursor blinking is done in the same way. The spurce rect is changed every 8 frames. You can get a clear idea.
I think I'm understanding, Thank you very much Fantasist!! You came closest to answering my wuestion.
I can't get it to work...This is my line of code:
def update
# Update menuactor frame count
@menuactor = (@menuactor + 1) % 8
# Update for menuactor
if @menuactor < 0
@menuactor.src_rect.empty
else
if @menuactor < 4
@menuactor.src_rect.set(0, 0, 32, 48)
else
if @menuactor < 8
@menuactor.src_rect.set(32, 48, 32, 48)
else
if @menuactor < 12
@menuactor.src_rect.set(64, 96, 32, 48)
else
@menuactor.src_rect.set(96, 128, 32, 48)
end
end
end
end
end
end
**But I always get this error >>
(http://i212.photobucket.com/albums/cc283/Derek16438/RMXP%20Errors/untitled.png)
@menuactor is supposed to be a sprite, not a number. src_rect is a property of a sprite, not a number (the 'Fixnum' roughly means the numbers class). You use another variable to control the counter, like @count or something. It should be like this:
def update
# Update menuactor frame count
@counter = (@counter + 1) % 8
# Update for menuactor
if @counter < 0
@menuactor.src_rect.empty
else
if @counter < 4
@menuactor.src_rect.set(0, 0, 32, 48)
else
if @counter < 8
@menuactor.src_rect.set(32, 48, 32, 48)
else
if @counter < 12
@menuactor.src_rect.set(64, 96, 32, 48)
else
@menuactor.src_rect.set(96, 128, 32, 48)
end
end
end
end
end
end
Another thing. Instead of
"else
if"
You can directly use "elsif" like this:
def update
# Update menuactor frame count
@counter = (@counter + 1) % 8
# Update for menuactor
if @counter < 0
@menuactor.src_rect.empty
elsif @counter < 4
@menuactor.src_rect.set(0, 0, 32, 48)
elsif @counter < 8
@menuactor.src_rect.set(32, 48, 32, 48)
elsif @counter < 12
@menuactor.src_rect.set(64, 96, 32, 48)
else
@menuactor.src_rect.set(96, 128, 32, 48)
end
end
And of course, don't forget to do this in the initialize method:
@menuactor = Sprite.new
@menuactor.bitmap = <set your bitmap, like RPG::Cache.picture('pic_name') or just Bitmap.new('path with name')>
@counter = 0
Alright!! See now I understand!! Thank you Fantasist!
>> I've been tinkering with this script snipplet for some time now, and I still haven't been able to get it to work, is it because I'm trying to use it in a window, which is constantly refreshing itself?? The Arrow_Base doesn't have a single refresh methos in it's coding...
Is it possible to call an @"whatever" from a different class, so long as they are in the same script??
For reference, say I just wanted to sexperiment with this snipplet, where would I use it?? In a window, or a scene or what?? Where does this code go??
can someone make a script that makes tilesets animated? and add it to tons :P
How about using autotiles and auto animated events? -_-
I don't understand what you mean Blizzard...
BTW, you think you might be able to shed some light on the subject being discussed??
You can have animated autotiles like the water tile. And how about using events to animate stuff like flowers. A fully animated tileset could be possibly made by modifying the tileset swap script. In any of those cases the lag would increase pretty much.
I'm not concerned with animated tilesets, I use charactersets for animated events. I'm more concerned with the animated charactersets being shown in windows...
he was answering Susys question not yours than Calintz
I know...
QuoteI've been tinkering with this script snipplet for some time now, and I still haven't been able to get it to work, is it because I'm trying to use it in a window, which is constantly refreshing itself??
Depends on whether you're updating the window in the scene's update.
put this code in the update method of the scene:
@the_win.update
where @the_win is an instance of the window in which you defined the update method (changing rects)
Note that you need to initialize (@the_win = Window_AnimChar.new) in the scene's 'main' method
You defined the code for src_rect in a method called 'update'. Now, that code is executed only when the method is 'called'. In every scene, in main, you see this:
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
So you see? The 'update' method is called every frame, that is, 40 times per second. That's why in every scene, most of your code goes into the method 'update'. Now let's say you've used your code in a window class named Window_AnimChar. That is, you've defined a class Window_AnimChar, and defined the update method as in the code (changing the rect). Now you've initialized (or 'created') this object in the scene, say Scene_Menu, like this in 'main:
@char_win = Window_AnimChar.new
Now unless you update this window in the scene's update, it wont be updated. So in the scene's update method, you add this:
@char_win.update
So now, since the update of the scene is 'called' every frame, all the code gets executed all the time. And You called the update of the window (@char_win.update), so even that gets updated every frame. Get it?
Tip: None of the followin methods are in-built into the RGSS dll, you can change how everything works and you can see how everything works unlike built-in functions.
1. main
2. update
3. refresh