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

2014/10/25

Velocity

JamesHughes JamesHughes

2014/10/25

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Debris here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Debris extends SmoothMover
{
    private static final Vector GRAVITY = new Vector(90,1.5);
    public Debris()
    {
        
    }
    /**
     * Act - do whatever the Debris wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
       increaseSpeed(GRAVITY);
       move (4);
    }    
}
I am new to greenfoot and i am currently following youtube tutorials. On "creating explosions part 2 of 5" it tells me to add increaseSpeed. This should make it fall slowly and speed up. when i press compile it says "cannot find symbol". i assume this is because it is an old tutorial and increase speed is no longer in greenfoot. Are there any alternatives to increase speed in greenfoot now? thanks.
JamesHughes JamesHughes

2014/10/25

#
P.s the youtube tutorials are by Channel Greenfoot
danpost danpost

2014/10/25

#
'increaseSpeed' was never in greenfoot. It may have been a method in a version of the SmoothMover class, however. Open the code editor on the SmoothMover class and do a 'Find' on 'increaseSpeed' and you will probably find that there are no instances of that character string. Change the view to documentation (in the upper-right of the editor there is a drop-down option box for 'source view/documentation view'). See what method is available for adjusting the speed and use it instead.
You need to login to post a reply.