Hello, can someone explane to me what this means in greenfoot game?. Im trying create brick's game and i find some game examples, but i dont understand who's the hell is "denom" and "accum". Thanks alot who help me. :)
public class Kamuoliukas extends Actor { public static int BALLSIZEX = 10; public static int BALLSIZEY = 10; private int motionX; private int motionXdenom; private int motionXaccum; private int motionY; private int motionYdenom; private int motionYaccum; private int ballSpeed; public Kamuoliukas() { motionX = -20; motionXdenom = 10; motionY = -20; motionYdenom = 10; ballSpeed = (int) Math.sqrt(motionX * motionX + motionY * motionY); } public static Bounds getBounds(Actor go) { Bounds b = new Bounds(); int width = go.getImage().getWidth(); int height = go.getImage().getHeight(); b.lx = go.getX() - width / 2; b.ty = go.getY() - height / 2; b.rx = b.lx + width; b.by = b.ty + height; return b; } public void act(){ //here you can create the behaviour of your object int newX = getX() + motionX / motionXdenom; int newY = getY() + motionY / motionYdenom; motionXaccum += motionX % motionXdenom; motionYaccum += motionY % motionYdenom; // X direction adjustments if (motionXaccum >= motionXdenom) { newX++; motionXaccum -= motionXdenom; } else if (motionXaccum < 0) { newX--; motionXaccum += motionXdenom; } // Y direction adjustments if (motionYaccum >= motionYdenom) { newY++; motionYaccum -= motionYdenom; } else if (motionYaccum < 0) { newY--; motionYaccum += motionYdenom; } // bounce off walls if (newX < BALLSIZEX / 2) { newX = BALLSIZEX / 2; motionX = -motionX; } else if (newX + BALLSIZEX / 2 >= BrickWorld.SIZEX) { newX = BrickWorld.SIZEX - BALLSIZEX / 2; motionX = -motionX; } if (newY < BALLSIZEY / 2) { newY = BALLSIZEY / 2; motionY = -motionY; } else if (newY + BALLSIZEY / 2 >= BrickWorld.SIZEY) { newY = BrickWorld.SIZEY - BALLSIZEY / 2; motionY = -motionY; } setLocation(newX, newY); int centerX = getX(); int centerY = getY(); }