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

2012/8/2

inserting video??

Andriyanto Andriyanto

2012/8/2

#
i want ask u, all.. can i insert video in greenfoot/game scenario greenfoot? How? please tell me..
Morran Morran

2012/8/2

#
I think that you can insert animated GIF files into Greenfoot... Try looking at this page.
MatheMagician MatheMagician

2012/8/2

#
This might be closer to what you are looking for.
Andriyanto Andriyanto

2012/8/3

#
thankyou all, i was make a game education for children, but i must insert animation or video so that children understand.. if i have problem, i can ask you again? :D
SPower SPower

2012/8/3

#
Andriyanto wrote...
...insert animation...
Little extra, if you want to insert animation (not video), Morrans answer is the best (of the 2 :) ).
Andriyanto Andriyanto

2012/8/6

#
SPower..okthank you.. i want ask again.. this is code from http://www.greenfoot.org/scenarios/5309
import greenfoot.*; 

public class video extends Actor
{
    int frame2 = 0;
    int frame3 = 0;
    int frame = 0;
    int frameH = 9;
    int frame2H = 100;
    int time = 0;
    String name ="video (";
    String brak = ")";
    boolean stop = false;
    /**

    public void act() 
    {        
        
        if(!stop)
            try
            {
                frame ++;
                setImage(name+frame+brak+".jpg");
            }
            catch (java.lang.IllegalArgumentException iae)
            {
                stop = true;
        }
        if(Greenfoot.isKeyDown("space"))
        {
            if(!stop)
            stop = true;
            else
            stop=false;
        }

        getImage().scale(300,200);
    }    

}
how to make delay??? very fast..
tylers tylers

2012/8/6

#
what do you mean???
Andriyanto Andriyanto

2012/8/6

#
bagaimana agar pergantian frame tidak terlalu cepat? membuat delay untuk mengurangi kecepatan pergantian frame.
Andriyanto Andriyanto

2012/8/6

#
how to change the frame is too fast? create a delay to reduce the speed of change of frame.
tylers tylers

2012/8/6

#
cant you just change the speed in the bottom corner?
danpost danpost

2012/8/6

#
Lines 29 through 35 can be written as:
if (Greenfoot.isKeyDown("space")) stop = !stop;
However, using 'isKeyDown' is not really appropriate for what it is doing. Unless the speed of the scenario (using the speed slider) is fairly slow, it would be very difficult, if not impossible, to have the code only register once when the key is pressed. It would be basically pot-luck on what state ('stop' or '!stop') it would land on by the time the user releases the key. Better, would be to use 'getKey'; or, if you would rather, use 'isKeyDown', but add a boolean to indicate 'spacePressed'. Then the code snippet would look like this:
boolean spacePressed = false; // declared in class
//
if (!spacePressed && Greenfoot.isKeyDown("space")) 
{
    stop = !stop;
    spacePressed = true;
}
if (spacePressed && !Greenfoot.isKeyDown("space")) spacePressed = false;
Andriyanto Andriyanto

2012/8/7

#
tyler : yes i can, but i want create a delay to reduce the speed of change of frame. danpost : oh, so can not make the delay? ok thank you..
You need to login to post a reply.