Im just a beginner, so sorry if its a stupid question being asked.
I want the slowmotion to be activated when the slowmo object collides with the player object.
This is my code for this. When the 2 objects collide the the slowmo object gets removed and the game slows down but after a certain time the game is not getting back to the original speed.
Any help is appreciated. Thanks in Advance
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class SlowMotion here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SlowMotion extends Actor
{
public int slowtime = 5;
boolean slowmotion = false;
/**
* Act - do whatever the SlowMotion wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
checkForSlowmo();
slowmotionspeed();
}
public void checkForSlomo()
{
if (getOneIntersectingObject(Player.class) != null)
{
slowmotion = true;
getWorld().removeObject(this);
slowtime--;
if (slow < 0)
{
slowmotion = false;
slow = 50;
}
}
}
public void slowmotionspeed()
{
if (slowmotion = true)
{
Greenfoot.setSpeed(40);
}else
{
Greenfoot.setSpeed(50);
}
}
}

