Jump to content

Announcing our new website

To find out the latest about our new website, visit Game Dev Unlimited

- - - - -

Showing animation in script


  • You cannot reply to this topic
4 replies to this topic

#1 bigace

    King of Spades

  • Member
  • 732 posts

Posted 19 December 2011 - 01:52 PM

How do you make skill animations appear using a script, as I was going to put in the skill menu, but I have no clue how to script that.

#2 kellessdee

    mrrow ~!

  • Moderator
  • 904 posts

Posted 20 December 2011 - 05:23 PM

To display an animation you need 2 things: An object that either is a RPG::Sprite or a subclass of RPG::Sprite and the animation's ID.

Once you have an object that is of the RPG::Sprite type, you can call
sprite_object.animation( id, hit )
id is the Animation ID
hit is either true or false, and represents whether the "hit" or "miss" animation is displayed. true will be handled as a hit.

if you set the id to nil, the animation will stop.

Also, there is:
sprite_object.loop_animation( id )
This will cause the animation to continuously loop, until stopped

RPG::Sprite#update will update any existing animations set to the sprite.

Hope this is what you were looking for :)

#3 Polraudio

    Master of the Mind

  • Moderator
  • 3,479 posts

Posted 20 December 2011 - 06:31 PM

Not to steal the topic but would that mean i can use this to target a picture in the script?
EX: i have the player sprite shown in the skill menu and when i press P it will show what skill i have selected on the player sprite.

#4 kellessdee

    mrrow ~!

  • Moderator
  • 904 posts

Posted 20 December 2011 - 07:33 PM

Yes and no. You would be able to do this, however, the way that RPG Maker's default menu is set up; it draws the player's sprite onto the window's bitmap; and there isn't a way to target that window or it's bitmap. (Neither are of the RPG::Sprite type)

2 (simple) ways to get around this (there are many ways, these are probably easiest to implement in an existing menu):

1. Create an empty RPG::Sprite, and position it to the same location as where the player's sprite is drawn, then call the animation.
2. Change the existing code to create the player's sprite AS a RPG::Sprite instead of drawing it to the bitmap, and position it in the right place; then call the animation.

Lemme know if you need more help/example on how to do this.

#5 bigace

    King of Spades

  • Member
  • 732 posts

Posted 20 December 2011 - 10:42 PM

THanks for the help I'll get to it soon as finish this other thing.





0 user(s) are reading this topic

members, guests, anonymous users