Help with Battle Animation Sequence and ATL

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
biensoftworks
Newbie
Posts: 8
Joined: Mon Jan 22, 2018 11:36 pm
Projects: Candy Powder Cafe
Organization: biensoftworks
Soundcloud: urtypicalotakunerd
itch: biensoftworks
Location: the Philippines
Contact:

Help with Battle Animation Sequence and ATL

#1 Post by biensoftworks »

Greetings to the knowledgeable guys and gals of this wonderful forum!

I made a separate thread of the animation question I had from my original thread.

viewtopic.php?f=8&t=49150

I just got home from a month long trip and lost some knowledge about the coding and where I left off. I tinkered with my game codes and tried to animate the battle screens I needed to do on my game.

So it goes like this. The battle has a command screen where you could select the action for battle. All the moveset have been programmed but the sprites aren't.

I used this code in defining one of the basic attacks:

Code: Select all

image char attack:
     "image/a1.png"
     pause .15
     "image/a2.png"
     pause .15
     "image/a3.png"
     pause .15
     "image/a4.png"
     pause .15
     "images/a5.png"
     pause .15
Since the battle sprites are set quite far away with each other, I made a dashing sprite for each attack which will make the character dash in-front of the enemy and perform the action.

Code: Select all

image char dash:
     "image/d1.png"
     pause .15
     "image/d2.png"
     pause .5
     "image/d3.png"
     pause .15
     
transform move_dash:
     xpos 850 ypos 250
     linear 3.0 xpos 450

Here is where it will be called in the process:

Code: Select all

label attack:
     show char dash at move_dash
     show char attack
But whenever I test it, the character will attack while moving along the screen and the dash animation doesn't play.

Second thing I'm checking for is like, is there a way to make the enemy sprite show damage or flinch/jerk whenever a character lands a hit on the enemy? I tried doing it with the sprites close to each other but the enemy sprite already flinched before the attack is being executed. I tried the same method as what I'm gonna present next but it doesn't look satisying and is kinda glitchy.

Lastly, is there a way to add sound effects and voices during the attack? Like formthe basic attack, the character will give a "Hyaah!" and then a woosh sound will play then lastly, a hit sound. I tried doing it like this but it doesn't work right. I split the attack animation into four: attack_1 for the preparation, attack_2 for the movement, attack_3 for the hit, and attack_4 for the return to stance but it takes a large amount of code and works kind of glitchy.

Code: Select all


label attack:
     show char attack_1
     play voice char_001
     voice sustain
     
     show char attack_2
     play sound woosh
     
     show char attack_3  
     play sound hit
     
     show char attack_4
     play sound woosh

I think that was a lot of amateurish codes, I just need some ways to lessen up the chunk of codes and learn a bit about the complicated ATL to make my battle screen interesting.

I'm looking forward to all your help ^uJ

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Help with Battle Animation Sequence and ATL

#2 Post by kivik »

The animation not playing makes sense to me, you're showing the images back to back so as soon as the show dash command's executed it'll start the show attack - and since you're showing the same image tag "char" the first one should disappears straight the way. I've not tried this time of animation but I expect a pause with the expected time duration in between should fix that so that one thing is played before the second. Btw, 3 seconds is a very long time in animation, you may want to reduce your move_dash duration.

Your second problem is similar to the first: only this time since your enemy has a different image tag than your char, both images are shown at the same time. Now if your enemy is supposed to flinch when the attack lands - then you need to pause the animation for the duration leading up to the attack blow. So in your case, let's say a4.png is the landing blow - then you'd need your flinch image to start after a pause .45.

I haven't at all dabble in sound so I can't say for sure about the last problem, but it's probably again the same issue of things being executed immediately after each other because you have no pauses in between.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Help with Battle Animation Sequence and ATL

#3 Post by gas »

Solution.
Merge the animations into one.
As for sound, renpy begin the execution of the animation then suddendly skip to the next statement.
To solve this,

Code: Select all

show chara at whatever
$ renpy.pause(3.0,hard=True)
where 3.0 is the lasting of animation, then play your sound.
Renpy is not a movie maker app ;).
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
biensoftworks
Newbie
Posts: 8
Joined: Mon Jan 22, 2018 11:36 pm
Projects: Candy Powder Cafe
Organization: biensoftworks
Soundcloud: urtypicalotakunerd
itch: biensoftworks
Location: the Philippines
Contact:

Re: Help with Battle Animation Sequence and ATL

#4 Post by biensoftworks »

I managed to follow kivik's advice and it worked the way I wanted it.

@gas, I know what Ren'py is capable of doing and I'm aware thatit's not a movie making app. What I wanted to do was an arcade style battle screen (e.g Fate: Grand Order, Granblue Fantasy, Final Fantasy)

Now I have another question, is there any way to disable the user input to avoid skipping the attack animations? Here is the code that I'm using for the normal attack:

Code: Select all

label attack:
    $ attack = "normal"
    
    hide_screen command
    
    ##The character will dash toward the enemy
    play voice "take_this.wav"
    show char dash at move_dash
    pause .50
    
    
    ##The character lands an attack on the enemy and the enemy flinches
    show char attack
    show nme stance
    pause .50
    play sound "woosh.wav"
    pause .10
    play sound "hit.wav"
    show nme dmg with hpunch
    $ nme_life -= 5
    
    ##The character goes back to starting position
    show nme stance
    pause .10
    show char backdash at move_backdash
    
    jump command_select
I appreciate your help guys~! I'm eternally greatful!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Help with Battle Animation Sequence and ATL

#5 Post by kivik »

You need to use hard pause: https://www.renpy.org/doc/html/other.html#renpy.pause

Never used it, but it's been mentioned a lot in the forum so it should do what you want :)

User avatar
biensoftworks
Newbie
Posts: 8
Joined: Mon Jan 22, 2018 11:36 pm
Projects: Candy Powder Cafe
Organization: biensoftworks
Soundcloud: urtypicalotakunerd
itch: biensoftworks
Location: the Philippines
Contact:

Re: Help with Battle Animation Sequence and ATL

#6 Post by biensoftworks »

@kivik

I tried using hard pause, I replaced the regular pause with it and it indeed worked, I used it like this:

Code: Select all

label attack:
    $ attack = "normal"
    
    hide_screen command
    
    ##The character will dash toward the enemy
    play voice "take_this.wav"
    show char dash at move_dash
    $ renpy.pause(delay=.50,hard=True)
    
    
    ##The character lands an attack on the enemy and the enemy flinches
    show char attack
    show nme stance
    $ renpy.pause(delay=.50,hard=True)
    play sound "woosh.wav"
    $ renpy.pause(delay=.10,hard=True)
    play sound "hit.wav"
    show nme dmg with hpunch
    $ nme_life -= 5
    
    ##The character goes back to starting position
    show nme stance
    $ renpy.pause(delay=.10,hard=True)
    show char backdash at move_backdash
    
    jump command_select
Now here's the problem with it: it skipped the sounds and the "hpunch" effects. The animation ran smoothly and doesn't interrupt when I click it but the other neccessary events never played.

Is there any other way to fix it?

Thanks in advance!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Help with Battle Animation Sequence and ATL

#7 Post by kivik »

Oh dear, I'm afraid this has definitely gone beyond my experience! Hopefully someone else familiar with this scenario can help - sorry I'm not able to! :(

Post Reply

Who is online

Users browsing this forum: No registered users