Discuss Scratch

Writing_Ninja
Scratcher
1 post

Timely Costume Transitions

I'm a bit stumped on how to be capable of switching costumes in a set of costumes timely while being able to transition to a different set of costumes without the first costume set's pattern trying to finish itself or any of its wait blocks getting in the way.
Basically, in my project I'm playing around with a player-controlled adventurer sprite (unoriginal) and whenever I try and draw the sword, the idle animation (first costume set) will (sometimes) get in the way of the sword unsheathing (second costume).
My goal is to possibly find an alternative to wait blocks, detect any possible errors and generally learn any better methods from the Scratch community.
My project is here. https://scratch.mit.edu/projects/263035265/#editor
Any help is deeply appreciated!

Zizzle8383
Scratcher
100+ posts

Timely Costume Transitions

when green flag clicked
forever
if <key [(can be var this is just demonstration) v] pressed?> then
set [draw sword on? v] to [true]
else
set [draw sword on? v] to [false]
end
if < [draw sword on? v] = true>
sword animation
else
idle animation


end
Th3_C0d3r
Scratcher
100+ posts

Timely Costume Transitions

Here's a remix: https://scratch.mit.edu/projects/263153382/

That's because you have TWO forever loops fighting each other over which costume to display. Simple fix really, just merge them into one big game loop.

Sorry I got a little bit carried away and went all out on this one
Anyways, if you want, let me know if you need further explanation on how the scripting works.

Edit
Credit: mstone326

-Scratch On!

Last edited by Th3_C0d3r (Nov. 19, 2018 06:18:59)

Powered by DjangoBB