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

2019/3/14

Control Animated gif with key press

dejong1968 dejong1968

2019/3/14

#
I have a working animated gif in Greenfoot. Now I want to control it with a key so that the full animation just 'runs' once when that key is pressed. I tried:
1
2
3
if (Greenfoot.isKeyDown(" ")){
                        setImage(gifImage.getCurrentImage());
    }
But when I run it, the gif does nothing or it just moves a bit very very shortly but not fully. It must have something to do with the length of every act. Any help would be appreciated. Thanks!
danpost danpost

2019/3/14

#
Line 1 should read:
1
if (Greenfoot.isKeyDown("space")){
Any change at all? (not sure if that had anything to do with any part of your issue)
You need to login to post a reply.