I have a bat who needs to flap his wings slower. His script is like this:
[blocks]<when[ right arrow ]key pressed>
<forever if>[/blocks] right arrow pressed?
[blocks]<next costume>
<move(3)steps>
<switch to costume[1][/blocks]
This, however, makes the wings flap rapidly. How do I make them flap slower?
Last edited by CarolineandGir (2011-07-07 21:15:34)
Offline
You could as one option add more costumes in the flap animation, that way there are more frames to flip through. I'm assuming you're using a default bat sprite though, so you could also add a delay to each costume change, like this:
Offline
Harakou wrote:
You could as one option add more costumes in the flap animation, that way there are more frames to flip through. I'm assuming you're using a default bat sprite though, so you could also add a delay to each costume change, like this:
http://i.imgur.com/46ZAr.gif
Why do you feel the need to overcomplicate things?
_______________________________
[when key [left arrow V] pressed]_________
[ repeat (insert number of costumes here)]
[ ][next costume]
[ ][wait (0.1) secs]________________________
[_______________________________________]
Offline
henley wrote:
Harakou wrote:
You could as one option add more costumes in the flap animation, that way there are more frames to flip through. I'm assuming you're using a default bat sprite though, so you could also add a delay to each costume change, like this:
http://i.imgur.com/46ZAr.gifWhy do you feel the need to overcomplicate things?
_______________________________
[when key [left arrow V] pressed]_________
[ repeat (insert number of costumes here)]
[ ][next costume]
[ ][wait (0.1) secs]________________________
[_______________________________________]
But that makes the movement jerky. Harakou's is smoother. Of course, you could always split it into two scripts and use your script and CoralineandGir's script minus the costume changes.
Offline
You could add a [wait ( ) secs] block... but make sure the wait time is a small decimal so the animation doesn't get TOO choppy, e.g. 0.125 or 0.25. If 0.125 or 0.25 is already too choppy, experiment with different numbers until you get what you want.
Highlight ----->Actually, Harakou's is better.
Last edited by a1130 (2011-07-08 21:17:59)
Offline
I think I got it. Okay, KEEP your script. Only add one thing. Add a wait block after the move 3 steps or whatever steps WAIT (maybe 3-5 seconds) then switch back to costume 1. You should put a forever there . Also, you shouldn't use when key pressed. I am pretty sure movements are jerky. So just do a when flag clicked forever if key right arrow pressed your script (including my addition) minus the when something key pressed. Of course, do the same thing for the left arrow key (but make sure to have costumes facing the other way!). Hope this helped . Good luck on your game!
Offline
a1130 wrote:
You could add a [wait ( ) secs] block... but make sure the wait time is a small decimal so the animation doesn't get TOO choppy, e.g. 0.125 or 0.25. If 0.125 or 0.25 is already too choppy, experiment with different numbers until you get what you want.
Highlight ----->Actually, Harakou's is better.
Woops didn't see your post.
Offline
For the "when key [] pressed" problem simply add a "repeat until < not < key [] pressed > >"
Last edited by LordSydney (2011-07-09 00:51:10)
Offline
You could try adding more costumes. Copy the first costume 5 times, then copy the second costume 5 times, so there are 5 copies of the first costume, then 5 copies of the second, and so on.
Offline
CarolineandGir wrote:
I have a bat who needs to flap his wings slower. His script is like this:
[blocks]<when[ right arrow ]key pressed>
<forever if>[/blocks] right arrow pressed?
[blocks]<next costume>
<move(3)steps>
<switch to costume[1][/blocks]
This, however, makes the wings flap rapidly. How do I make them flap slower?
One way to solve this is to make the bat fly all the time with a script that says:
when green flag clicked forever switch costume wait one second switch costume. If that wasn't clear it's because I fail at using the scratch blocks on here
Last edited by emboar30 (2011-07-10 02:31:03)
Offline
i like to have as few scripts running at once as possible so i don't like the multiple script suggestions. i have to agree with harakou. however i would make one change.
instead of forever if, i would put all movement code in the same forever with a bunch of if statements.
i don't like having a lot of global variables either, but this one can be local so idc.
i can't use these block things effectively in the forums so i will stick with text
Offline
estorken wrote:
i like to have as few scripts running at once as possible so i don't like the multiple script suggestions. i have to agree with harakou. however i would make one change.
instead of forever if, i would put all movement code in the same forever with a bunch of if statements.
i don't like having a lot of global variables either, but this one can be local so idc.
i can't use these block things effectively in the forums so i will stick with text
Oh, I just used forever if because I was being lazy. I usually use an if inside of a forever block too.
Offline
Thescratch3 wrote:
a1130 wrote:
You could add a [wait ( ) secs] block... but make sure the wait time is a small decimal so the animation doesn't get TOO choppy, e.g. 0.125 or 0.25. If 0.125 or 0.25 is already too choppy, experiment with different numbers until you get what you want.
Highlight ----->Actually, Harakou's is better.Woops didn't see your post.
It's OK. Sometimes people agree on the same thing, sometimes they each have different opinios.
Offline