Discuss Scratch

renegade9x
New to Scratch
6 posts

the costume doesnt change back to the two costumes i want, but a mix of two costumes?

Here is my project http://scratch.mit.edu/projects/13008334/
I have scripted it so that the normal costume of the ghost is changing between two costumes. So that it looks like the ghost is having an animation. When the ghost picks up a banana (the powerup) i scripted it so that the ghost will flicker between the old costumes and the powered up costume. Then the powered up costume got two costumes as well, so it also looks like it is animating. This works really fine.

The problem comes when it hits a car or a brown ghost. I wanted to have the ghost die if it gets hit by a car or a brown ghost. But not when it is powered up - then it will transform back into its normal state. The powered up version will also change back to its normal state automatically after 8 seconds. This works also fine. But when the ghost is in powered up state and hits car/brown ghost, it begins to flicker between the normal state and the powered up state. I've been debugging it probably 2 hours and just can't find the problem. I've changed the code several times from several objects (almost redone 30% of all the code) but it still is the same problem.

if you have time, please try the game you will see. Change the code of the banana under (When green flag clicked > wait 10-20 sec) to just 1-1 seconds to get the banana to appear faster so you can power up the ghost and see the problem for yourself. Hope this makes any sense!

Really need help with this and would be much appreciated!!
Photoguy77
Scratcher
100+ posts

the costume doesnt change back to the two costumes i want, but a mix of two costumes?

when gf clicked
set [powerdup? v] to (0)
forever
if <touching [banna v]>
set [poweredup?] to (1)
end
if <(poweredup?) = (1)> then
powerdup costumes
else
nonpoweredupcistumes
end
end


define nonpoweredupcistumes // so it won't be red
define powerdup costumes // so it won't be red

Last edited by Photoguy77 (Oct. 8, 2013 21:28:14)


-Photoguy77

“Without enjoying, one will never truly learn” ~Flome

“Finding happiness starts in you” ~ProdigyZeta7

renegade9x
New to Scratch
6 posts

the costume doesnt change back to the two costumes i want, but a mix of two costumes?

Thank you for your swift reply. I must admit i am not quite sure what it means though. Could you explain it a bit easier for me?
renegade9x
New to Scratch
6 posts

the costume doesnt change back to the two costumes i want, but a mix of two costumes?

I re-read it a couple of times and understand it now. It makes a lot of sense, although how do i define the costumes?
renegade9x
New to Scratch
6 posts

the costume doesnt change back to the two costumes i want, but a mix of two costumes?

I fixed it wiht your help! I used the “IF ELSE” statement. had to put a “repeat until” loop inside the first if. The repeat until would be “repeat until poweredup = 1”, then it would change the animation. Previously it didnt have this repeat until, so the unpowered animation would only play once! Thanks photoguy77!!

Powered by DjangoBB