Character Sprite Zooming

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

characterSpriteZooming1

This script allows you to control the zoom-level for character sprites, which includes the player, followers, events, and the default vehicles. All it does is change the look of the sprite.

Functions are available for creating zoom animations over a specified duration.

Note that the engine supports many different ways of drawing character sprites. This script only supports character *sprites*, rather than character images.

Download

Script: download here

Installation

In the script editor, place this script below Materials and above Main

Usage

Events

To change event sprite zooming on the map, use one of the script calls

zoom_event_sprite(ID, zoom)
zoom_event_sprite(ID, zoom, duration)
zoom_event_sprite(ID, zoom, duration, wait)
zoom_event_sprite(ID, zoom, duration, wait, zoom_y)
zoom_event_sprite(ID, zoom, duration, wait, zoom_y, duration_y)

Where the ID is the ID of the event, and the zoom is a percentage. 1 is 100%, 0.5 is 50% (half size), and 2 is 200% (double size)

The duration allows you to create a zoom animation over-time. It is specified in frames and can be any integer that is 0 or higher.

If `wait` is true, then the event will stop processing commands until the zoom animation is complete. If it is false, it will continue to run even though the animation is still going.

When only one `zoom` value is specified, it assumes both the width and height will be zoomed proportionally.

You can specify separate zoom behavior for each direction by passing in additional arguments.

Player

To change player sprite zooming, use one of the script calls

zoom_player_sprite(zoom)
zoom_player_sprite(zoom, duration)
zoom_player_sprite(zoom, duration, wait)
zoom_player_sprite(zoom, duration, wait, zoom_y)
zoom_player_sprite(zoom, duration, wait, zoom_y, duration_y)

Vehicles

To change player sprite zooming, use one of the script calls

zoom_vehicle_sprite(type, zoom)
 zoom_vehicle_sprite(type, zoom, duration)
 zoom_vehicle_sprite(type, zoom, duration, wait)
 zoom_vehicle_sprite(type, zoom, duration, wait, zoom_y)
 zoom_vehicle_sprite(type, zoom, duration, wait, zoom_y, duration_y)

These are the vehicles that are available

:ship
 :boat
 :airship

Examples

Zoom event 3 to double the size

zoom_event_sprite(3, 2)

Zoom player and followers to half-size, over 60 frames

zoom_player_sprite(true, 0.5, 60)

Stretch ship’s width by 2 and shrink height to half.

Width will change in 30 frames, height will change in 60 frames. The event will not wait for the animation.

zoom_vehicle_sprite(:ship, 2, 30, false, 0.5, 60)
Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

18 Responses

  1. Jesseo says:

    I know this threads technically dead, but is there anyway to set the players zoom size to activate upon a certain region marker?
    I have a platformer style that has a view of a plane of grass which is the “battle stage” and I have it set up to look at almost a side view typed but I want it so when my player walks up he shrinks to give the distance illusion

  2. A says:

    Thank you very much. Found a little bug when loading a save data:

    Script 'Character Sprite Zooming' line 123: TypeError occured.
    no implicit conversion to float from nil

    So… I went there and added a “not nil” condition. And did the same on the following line:

    self.zoom_x = @character.zoom_x if @character.zoom_x != nil
    self.zoom_y = @character.zoom_y if @character.zoom_y != nil

    No problem so far, hope it helps. Keep up the good work!

  3. Max says:

    How do I edit the default sprite size? I want everything to be doubled by default.

    • Hime says:

      In Sprite_Character there are references to width and height being divided by 32. You can just set those to 64.

      • John says:

        I tried this and it hasn’t done anything, I’m changing the 32s in ‘Set Tile Bitmap’ am I doing it in the wrong place or is it something else?

        • Hime says:

          Those only affect events that should look like those tiles. Follow the regular bitmap methods

          • John says:

            So is there anyway to set different sprite sizes by default?

          • Hime says:

            By default, you can put a $ in front of your filenames like $actor1, and then the size of the sprite will be based on the size of each cell on the sheet.
            However, it assumes all of your sheets have only one actor, with 3 columns per row and 4 rows in total (one for each direction).

            You can refer to $BigMonster or something.

          • John says:

            Seeing your latest post. That’s not what I meant sorry. I was asking about zooming in on sprites by default. My sprites are too small and are terrible looking in game (due to size). And since I’m using GCH for making sprites the re-sizing tool is terrible on smaller things. And if I go and do it by hand I have to add more detail in or just change things making it less for the minimalistic sorta look I was going for.

          • Hime says:

            If you want to make them larger by default, you can look at the script to see how size is changed, then just manually call that directly in the initialize method.

  4. Vectra says:

    This is exactly what I’m looking for.

  5. Pach says:

    There seems to be a bug, which causes the game to crash outright without error, if zoom_player_sprite is called when the player is standing on a tile that is set to bush (make the bottom of the player sprite half-transparent when in it).

    It might be a problem within’ the game’s own coding, so there probably isn’t anything to add in the script to fix this, but I thought I’d mention it in case I’m wrong.

    • Hime says:

      Does this occur in a new project? I resized the player’s sprite and the lowest part of it is still semi-transparent. Without crashing.

  6. John Timmons says:

    In the meanwhile, you can step with wait commands.
    zoom_player_sprite(true, 0.9)
    Wait 1
    zoom_player_sprite(true, 0.8)
    Wait 1
    zoom_player_sprite(true, 0.7)
    Wait 1
    zoom_player_sprite(true, 0.6)
    Wait 1
    zoom_player_sprite(true, 0.5)

  7. KanaX says:

    Brilliant! Just What I wanted! Is there a way to have a smooth transition from the original size to the altered one? (without the need for manual event commands)

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax