Hey. I would like to make my actor not protrude world edge. It kinda goes halfway and then it blocks the move input. I kinda feel this is easy, but I can“t find anything online. Thanks!
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Kosik extends Actor
{
final String MoveLeft="Left";
final String MoveRight="Right";
public int movement=10;
public void act()
{
if(Greenfoot.isKeyDown(MoveLeft)){
move(-movement);
}
if(Greenfoot.isKeyDown(MoveRight)){
move(movement);
}
}
}
