Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Animations using Icons (quick script)

Note: I say quick script as it's only really one method that needs to be done. I don't know how easy or difficult this is, hopefully not too difficult.

I tried scripting a battle animations script for an ABS, that would use icons. I couldn't do it myself. Don't let the "battle animations" bit fool you, it doesn't even need the battle system or anything. :)

All I need is a method that will do this:


If player is facing right:

Show weapon icon - BELOW the player sprite (i.e. a lower layer) (is this possible?)
While changing the player's frame to the second one on row 3

Wait 4 frames

Then show the weapon icon with _slash on the end (i.e...  001-Weapon01_slash)
While changing the player's frame to the fourth one on row 3.

Wait 4 frames

Then show the weapon icon as normal, but with mirror = true
While changing the player's frame to the first one on row 3.

If player is facing left:

Show weapon icon - BELOW the player sprite, with mirror = true
While changing the player's frame to the second one on row 2

Wait 4 frames

Then show the weapon icon with _slash on the end (i.e...  001-Weapon01_slash) WITH MIRROR = true
While changing the player's frame to the fourth one on row 2.

Wait 4 frames

Then show the weapon icon as normal (no mirror)
While changing the player's frame to the first one on row 2.

If player is facing up or down:

Do nothing.



What I hope to create with this is something like this:

http://img.photobucket.com/albums/v108/ ... ordgif.gif[/img]


Code:
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def weapon_sprite_init
    @weapon_sprite = Sprite.new
    @weapon_sprite.x = $game_player.screen_x
    @weapon_sprite.y = $game_player.screen_y
    @weapon_sprite.z = 9999
    @stage = 0
  end
  
  def battle_anim

    loop do
    @stage += 1
    
    if @stage == 1
      spr = $game_party.actors[0].weapon_id
      $game_player.pattern = 2
      @weapon_sprite.bitmap = RPG::Cache.icon($data_weapons[spr].icon_name)
      if $game_player.direction == 4
        @weapon_sprite.x = $game_player.screen_x + 8
        @weapon_sprite.y = $game_player.screen_y + 39
        @weapon_sprite.mirror = true
      end
      if $game_player.direction == 6
        @weapon_sprite.x = $game_player.screen_x - 3
        @weapon_sprite.y = $game_player.screen_y - 40
        @weapon_sprite.mirror = false
      end

      @weapon_sprite.update
    end
    
    if @stage == 5
      @weapon_sprite.mirror = true if $game_player.direction == 6
      @weapon_sprite.mirror = false if $game_player.direction == 4
      $game_player.pattern = 3
      @weapon_sprite.update
    end

    if @stage == 9
      @weapon_sprite.bitmap = nil
      @weapon_sprite.update
      @stage = 0
      break
    end
    
    Graphics.update
    $game_player.update
    end
    
  end
  
  def weapon_sprite_dispose
    @weapon_sprite.dispose
  end
end

Notes:

Why can't you do this with events?

I am using visual equipment amongst other scripts. (They shouldn't conflict with this though)

How will this be called?

Just by a normal method call, I'll add it into the right place in the ABS. Like... do_battle_animation or something.



Please let me know if there's anything I've missed / that you're confused about.


Cya, ~Wyatt
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top