This site requires JavaScript, please enable it in your browser!
Greenfoot back
frequency
frequency wrote ...

2018/2/3

How can i play a gif when score is X only once?

frequency frequency

2018/2/3

#
Hello, This is the scenario http://www.greenfoot.org/scenarios/20785 Thanks!
danpost danpost

2018/2/3

#
Perform the check on the score when it changes -- not later (it will only change to X once).
frequency frequency

2018/2/4

#
What do you mean? How can i do it and where will i paste the code?
danpost danpost

2018/2/4

#
Whenever you have 'score = score + 1;' -- "when the score changes", check it for X value immediately after the change:
if (score == 'X')
and play the gif if the score is X. It will only play once because the score will only CHANGE to that value once. The score may stay at that value, but it would not be changing during that time -- so, the gif will not play again.
frequency frequency

2018/2/4

#
Thanks! How do i syntax the gif code? I got no idea! Its like setimage? and then i add it as setobject?
frequency frequency

2018/2/4

#
I test added it on main menu.I setimage the gif on a new "insane.class" and then added it with AddObject on the main menu. It did not play!
danpost danpost

2018/2/4

#
frequency wrote...
I test added it on main menu.I setimage the gif on a new "insane.class" and then added it with AddObject on the main menu. It did not play!
Show what you used in the "insane.class".
frequency frequency

2018/2/4

#
Nothing at all. Just a setimage before the class creation
danpost danpost

2018/2/4

#
frequency wrote...
Nothing at all. Just a setimage before the class creation
Then show how you set the gif as the image (from gif creation to setting it to the actor).
frequency frequency

2018/2/5

#
Hello,thanks for replying. How do i syntax the gif code? Do i place it as addObject after i set it as an image in the class i want? How do i syntax it? Thank you!
You need to login to post a reply.