Jump to content
Tuckie

animation of draw_text() ?

Recommended Posts

It would help if you drew all the letters in all the colors in a bitmap before hand and copy the bitmap directly. Anyway, doing it in a text box and in a menu isn't quite the same.

Share this post


Link to post
Share on other sites
On 11/30/2017 at 3:55 AM, Cirno said:

Thank you for such an interesting effect for text drawing!

These effects are those I also want to realize in recent days.

First I saw it in a new indie game named "Lion's Song"

I am an RPGmaker user from Chinese bbs “rpg.blue” which is used to name "66RPG".

May I translate your scripts to Chinese in "rpg.blue" for Chinese users who may be interested in it?

Author's name and copyright will be also posted for addiction.

Thank you so much again!

 

Hello! I'm glad you like this script! I would be glad if you translated this script for others to use!

I have an updated version of it which you can download from here.

When you credit the author I think you should also mention Kayzee who helped me make it in the first place.

Share this post


Link to post
Share on other sites
18 minutes ago, Kayzee said:

It would help if you drew all the letters in all the colors in a bitmap before hand and copy the bitmap directly. Anyway, doing it in a text box and in a menu isn't quite the same.

maybe im thinking about this wrong but it seems like a bit more effort than its worth to dynamically put together a huge image and blt() all the letters in? or do you mean just have a preset rainbow gradient "Limit" image and just change the color of that? actually now that you say that it wouldnt be too hard at all

Share this post


Link to post
Share on other sites

Thanks for making this. It mostly works for me. I was wondering if you know if it can be made compatible with yanfly message system.

Specifically when I set the variable for the text box width, this script will ignore this and write it starting on the left and not within the box size/position.

Additionally there is a typo

line 209     wait_for_one_chaaracter

character spelled wrong.
 

Share this post


Link to post
Share on other sites
1 hour ago, roninator2 said:

Thanks for making this. It mostly works for me. I was wondering if you know if it can be made compatible with yanfly message system.

Specifically when I set the variable for the text box width, this script will ignore this and write it starting on the left and not within the box size/position.

Additionally there is a typo

line 209     wait_for_one_chaaracter

character spelled wrong.
 

hmm. id have to take a look at yanfly's system to see how it handles changing the width. my best guess right now is that yanfly's circumvents the traditional position data hash for something else. A quick temporary fix on your end would be to simply add a value to the calculation on line 224:

letter.x = pos[:x] + self.standard_padding + 9 + $game_variables[79]

it's a little hacky, but with this it will take the number stored in game variable 79 (set this thru events) and shift all the letters of your text box by that many pixels to the right.

Share this post


Link to post
Share on other sites
13 hours ago, Tuckie said:

maybe im thinking about this wrong but it seems like a bit more effort than its worth to dynamically put together a huge image and blt() all the letters in? or do you mean just have a preset rainbow gradient "Limit" image and just change the color of that? actually now that you say that it wouldnt be too hard at all

 

I was thinking something more like a preset image, only instead of being loaded from a file it would be drawn when the scene starts using draw_text. I would predraw all the color combinations to a tall bitmap and just change what part of it to draw when it came to actually draw the menu.

Share this post


Link to post
Share on other sites
12 hours ago, Tuckie said:

hmm. id have to take a look at yanfly's system to see how it handles changing the width. my best guess right now is that yanfly's circumvents the traditional position data hash for something else. A quick temporary fix on your end would be to simply add a value to the calculation on line 224:


letter.x = pos[:x] + self.standard_padding + 9 + $game_variables[79]

it's a little hacky, but with this it will take the number stored in game variable 79 (set this thru events) and shift all the letters of your text box by that many pixels to the right.

Thanks for pointing that out. I got it to work (almost perfect), by using 

letter.x = pos[:x] + self.standard_padding + 9 + ((Graphics.width - $game_variables[42]) / 2)

I just had a few characters off a bit and when showing icons in the message they were a bit to the left. will play with it more.

 

edit* So the m's and w's are squished to the left for my font. the other letters are fine. without this script the text is good. putting 2 spaces before the icon display can make it be aligned properly.

Edited by roninator2

Share this post


Link to post
Share on other sites
5 hours ago, roninator2 said:

Thanks for pointing that out. I got it to work (almost perfect), by using 


letter.x = pos[:x] + self.standard_padding + 9 + ((Graphics.width - $game_variables[42]) / 2)

I just had a few characters off a bit and when showing icons in the message they were a bit to the left. will play with it more.

 

edit* So the m's and w's are squished to the left for my font. the other letters are fine. without this script the text is good. putting 2 spaces before the icon display can make it be aligned properly.

the "squish" for letters is usually just an RPGMaker thing - it doesn't like to handle characters in tiny spaces (every letter is it's own bitmap here) but if you used a text caching script like Mithran's it would fix that

Share this post


Link to post
Share on other sites

Wait, you aren't drawing the sprite based on the window's x too? Try this if you want it to be less hacky:

letter.x = self.x + pos[:x] + standard_padding

Also there should be more then enough room to avoid the squish I thought. I know my version should make it twice as wide as needed, For reference here is my whole method for making the letters:

 

  def process_anim_character(c, pos)
    text_width = text_size(c).width
    letter = Sprite_TextAnim.new(self.viewport)
    bitmap = Bitmap.new(text_width * 2, pos[:height])
    bitmap.font = self.contents.font
    bitmap.draw_text(0, 0, text_width * 2, pos[:height], c)
    letter.bitmap = bitmap
    letter.x = self.x + pos[:x] + standard_padding
    letter.y = self.y + pos[:y] + standard_padding
    letter.z = self.z + 10
    letter.anim_offset = @animchars.size
    letter.anim_type = @anim_type
    @animchars.push(letter)
    pos[:x] += text_width
  end
  

 

 

Share this post


Link to post
Share on other sites
11 minutes ago, Kayzee said:

Wait, you aren't drawing the sprite based on the window's x too? Try this if you want it to be less hacky:


letter.x = self.x + pos[:x] + standard_padding

Also there should be more then enough room to avoid the squish I thought. I know my version should make it twice as wide as needed, For reference here is my whole method for making the letters:

 


  def process_anim_character(c, pos)
    text_width = text_size(c).width
    letter = Sprite_TextAnim.new(self.viewport)
    bitmap = Bitmap.new(text_width * 2, pos[:height])
    bitmap.font = self.contents.font
    bitmap.draw_text(0, 0, text_width * 2, pos[:height], c)
    letter.bitmap = bitmap
    letter.x = self.x + pos[:x] + standard_padding
    letter.y = self.y + pos[:y] + standard_padding
    letter.z = self.z + 10
    letter.anim_offset = @animchars.size
    letter.anim_type = @anim_type
    @animchars.push(letter)
    pos[:x] += text_width
  end
  

 

 

that's probably a better solution
The version of the script I posted here is more or less adapted from a custom visual replacement of rpgmaker text box - so i think as i was coding that i wasnt so worried about the original placement of everything. so it seems there were some discrepancies left over from trying to re-adapt it to be more general purpose?

Share this post


Link to post
Share on other sites
On 12/10/2017 at 7:11 PM, Tuckie said:

the "squish" for letters is usually just an RPGMaker thing - it doesn't like to handle characters in tiny spaces (every letter is it's own bitmap here) but if you used a text caching script like Mithran's it would fix that

I have this script already.

with wiggly script

wiggly.PNG.6b146d636b87518b7ba5ec9e9bbb35fc.PNG

 

without script

wigglynot.PNG.f2d6f41f79520596cfa3970256b6bd50.PNG

 

*EDIT

Nevermind - Found that this script has problems with my battles as well. I must have more than one conflicting script.

Edited by roninator2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×